YaST Commits
Threads by month
- ----- 2024 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
November 2009
- 38 participants
- 1224 discussions
Author: rpmcruz
Date: Thu Nov 26 18:14:14 2009
New Revision: 59804
URL: http://svn.opensuse.org/viewcvs/yast?rev=59804&view=rev
Log:
* Reverted to development state.
Added:
trunk/gtk/src/CMakeLists.txt
Removed:
trunk/gtk/src/YGPackageSelector.cc
trunk/gtk/src/ygtkhandlebox.c
trunk/gtk/src/ygtkhandlebox.h
trunk/gtk/src/ygtknotebook.c
trunk/gtk/src/ygtknotebook.h
trunk/gtk/src/ygtktogglebutton.c
trunk/gtk/src/ygtktogglebutton.h
trunk/gtk/src/ygtktreemodel.cc
trunk/gtk/src/ygtktreemodel.h
trunk/gtk/src/ygtkzyppview.cc
trunk/gtk/src/ygtkzyppview.h
trunk/gtk/src/ygtkzyppwrapper.cc
trunk/gtk/src/ygtkzyppwrapper.h
trunk/gtk/src/yzypptags.cc
trunk/gtk/src/yzypptags.h
trunk/gtk/src/yzyppwrapper.cc
trunk/gtk/src/yzyppwrapper.h
Modified:
trunk/gtk/src/YGComboBox.cc
trunk/gtk/src/YGDialog.cc
trunk/gtk/src/YGDumbTab.cc
trunk/gtk/src/YGFrame.cc
trunk/gtk/src/YGImage.cc
trunk/gtk/src/YGInputField.cc
trunk/gtk/src/YGIntField.cc
trunk/gtk/src/YGLabel.cc
trunk/gtk/src/YGLayout.cc
trunk/gtk/src/YGMenuButton.cc
trunk/gtk/src/YGProgressBar.cc
trunk/gtk/src/YGPushButton.cc
trunk/gtk/src/YGRadioButton.cc
trunk/gtk/src/YGSelectionModel.cc
trunk/gtk/src/YGTable.cc
trunk/gtk/src/YGText.cc
trunk/gtk/src/YGUI.cc
trunk/gtk/src/YGUI.h
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/YGWidget.cc
trunk/gtk/src/YGWizard.cc
trunk/gtk/src/YGi18n.h
trunk/gtk/src/test.cc
trunk/gtk/src/ygtkbargraph.c
trunk/gtk/src/ygtkbargraph.h
trunk/gtk/src/ygtkcellrenderertextpixbuf.c
trunk/gtk/src/ygtkcellrenderertextpixbuf.h
trunk/gtk/src/ygtkfindentry.c
trunk/gtk/src/ygtkfindentry.h
trunk/gtk/src/ygtkhtmlwrap.c
trunk/gtk/src/ygtkhtmlwrap.h
trunk/gtk/src/ygtkratiobox.c
trunk/gtk/src/ygtkrichtext.c
trunk/gtk/src/ygtkrichtext.h
trunk/gtk/src/ygtkscrolledwindow.h
trunk/gtk/src/ygtksteps.c
trunk/gtk/src/ygtksteps.h
trunk/gtk/src/ygtktextview.c
trunk/gtk/src/ygtktreeview.c
trunk/gtk/src/ygtkwizard.c
trunk/gtk/src/ygtkwizard.h
Added: trunk/gtk/src/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/CMakeLists.txt?rev=59804…
==============================================================================
--- trunk/gtk/src/CMakeLists.txt (added)
+++ trunk/gtk/src/CMakeLists.txt Thu Nov 26 18:14:14 2009
@@ -0,0 +1,96 @@
+## Makefile.am
+
+set (gtk_yast_plugin_SRCS
+ YGBarGraph.cc
+ YGComboBox.cc
+ YGDialog.cc
+ YGDumbTab.cc
+ YGFrame.cc
+ YGInputField.cc
+ YGIntField.cc
+ YGImage.cc
+ YGMenuButton.cc
+ YGLabel.cc
+ YGLayout.cc
+ YGPackageSelectorPluginStub.cc
+ YGPushButton.cc
+ YGProgressBar.cc
+ YGRadioButton.cc
+ YGSelectionModel.cc
+ YGTable.cc
+ YGText.cc
+ YGUtils.cc
+ YGUI.cc
+ YGWidget.cc
+ YGWizard.cc
+ ygdkmngloader.c
+ ygtkcellrenderertextpixbuf.c
+ ygtkbargraph.c
+ ygtkfieldentry.c
+ ygtkhtmlwrap.c
+ ygtkmenubutton.c
+ ygtklinklabel.c
+ ygtkfindentry.c
+ ygtkfixed.c
+ ygtkimage.c
+ ygtkratiobox.c
+ ygtkrichtext.c
+ ygtksteps.c
+ ygtktextview.c
+ ygtktimezonepicker.c
+ ygtktreeview.c
+ ygtkwizard.c
+ )
+
+# if you tell cmake to install the icons/ directory
+# it will make room for the .svn dir as well...
+set (gtk_yast_plugin_DATA
+ icons/harddisk.png
+ icons/harddisk-full.png
+ icons/pkg-available.png
+ icons/pkg-available-locked.png
+ icons/pkg-installed.png
+ icons/pkg-install.png
+ icons/pkg-install-auto.png
+ icons/pkg-installed-locked.png
+ icons/pkg-installed-upgradable.png
+ icons/pkg-installed-upgradable-locked.png
+ icons/pkg-remove.png
+ icons/pkg-remove-auto.png
+ icons/pkg-locked.png
+ icons/pkg-unlocked.png
+ icons/pkg-upgrade.png
+ )
+
+## includes:
+
+include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
+include_directories (${GTK2_INCLUDE_DIRS})
+include_directories (${LIBYUI_INCLUDE_DIR})
+
+## target:
+
+add_library (py2gtk SHARED ${gtk_yast_plugin_SRCS})
+
+## libraries:
+
+target_link_libraries (py2gtk ${GTK2_LIBRARIES})
+target_link_libraries (py2gtk ${LIBYUI_LIBRARY})
+set_target_properties (py2gtk PROPERTIES SOVERSION 2)
+set_target_properties (py2gtk PROPERTIES LINK_FLAGS "--no-undefined")
+
+## install:
+
+install (TARGETS py2gtk LIBRARY DESTINATION ${UI_PLUGIN_DIR})
+install (FILES ${gtk_yast_plugin_DATA} DESTINATION ${DATADIR})
+
+add_subdirectory (pkg)
+
+## test:
+
+link_directories (${CMAKE_BINARY_DIR}/src)
+add_executable (test test.cc)
+target_link_libraries (test libpy2gtk.so)
+target_link_libraries (test ${GTK2_LIBRARIES})
+target_link_libraries (test ${LIBYUI_LIBRARY})
+
Modified: trunk/gtk/src/YGComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=59804&…
==============================================================================
--- trunk/gtk/src/YGComboBox.cc (original)
+++ trunk/gtk/src/YGComboBox.cc Thu Nov 26 18:14:14 2009
@@ -2,7 +2,8 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
+#define YUILogComponent "gtk"
+#include "config.h"
#include <YGUI.h>
#include "YGUtils.h"
#include "YComboBox.h"
Modified: trunk/gtk/src/YGDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.cc?rev=59804&r1…
==============================================================================
--- trunk/gtk/src/YGDialog.cc (original)
+++ trunk/gtk/src/YGDialog.cc Thu Nov 26 18:14:14 2009
@@ -2,7 +2,8 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
+#define YUILogComponent "gtk"
+#include "config.h"
#include "YGUI.h"
#include "YGDialog.h"
#include "YGUtils.h"
@@ -22,8 +23,8 @@
be a YGDialog and is swap-able.
*/
-#define DEFAULT_WIDTH 650
-#define DEFAULT_HEIGHT 600
+#define DEFAULT_WIDTH 700
+#define DEFAULT_HEIGHT 650
class YGWindow;
static YGWindow *main_window = 0;
@@ -36,6 +37,7 @@
// (ie. dump yast tree)
YWidget *m_child;
GdkCursor *m_busyCursor;
+ bool m_isBusy;
public:
YGWindowCloseFn m_canClose;
@@ -51,6 +53,7 @@
m_child = NULL;
m_canClose = NULL;
m_busyCursor = NULL;
+ m_isBusy = false;
{
std::stack<YDialog *> &stack = YDialog::_dialogStack;
@@ -90,7 +93,13 @@
}
if (_main_window) {
- gtk_window_set_default_size (window, DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ int width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT;
+ if (YGUI::ui()->defaultWidth())
+ width = YGUI::ui()->defaultWidth();
+ if (YGUI::ui()->defaultHeight())
+ height = YGUI::ui()->defaultHeight();
+
+ gtk_window_set_default_size (window, width, height);
if (YGUI::ui()->setFullscreen())
gtk_window_fullscreen (window);
else if (YUI::app()->displayWidth() <= 800 || YUI::app()->displayHeight() <= 600)
@@ -115,7 +124,6 @@
~YGWindow()
{
- IMPL
setChild (NULL);
if (m_busyCursor)
gdk_cursor_unref (m_busyCursor);
@@ -128,23 +136,26 @@
void normalCursor()
{
- gdk_window_set_cursor (m_widget->window, NULL);
+ if (m_isBusy)
+ gdk_window_set_cursor (m_widget->window, NULL);
+ m_isBusy = false;
}
void busyCursor()
{
- GdkDisplay *display = gtk_widget_get_display (m_widget);
if (!m_busyCursor) {
+ GdkDisplay *display = gtk_widget_get_display (m_widget);
m_busyCursor = gdk_cursor_new_for_display (display, GDK_WATCH);
gdk_cursor_ref (m_busyCursor);
}
- gdk_window_set_cursor (m_widget->window, m_busyCursor);
+ if (!m_isBusy)
+ gdk_window_set_cursor (m_widget->window, m_busyCursor);
+ m_isBusy = true;
}
void setChild (YWidget *new_child)
{
- IMPL
- GtkWidget *child = gtk_bin_get_child (GTK_BIN (m_widget));
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (m_widget));
if (child)
gtk_container_remove (GTK_CONTAINER (m_widget), child);
if (new_child) {
@@ -183,7 +194,6 @@
static gboolean close_window_cb (GtkWidget *widget, GdkEvent *event,
YGWindow *pThis)
{
- IMPL
// never let GTK+ destroy the window! just inform YCP, and let it
// do its thing.
pThis->close();
@@ -193,7 +203,6 @@
static gboolean key_pressed_cb (GtkWidget *widget, GdkEventKey *event,
YGWindow *pThis)
{
- IMPL
// if not main dialog, close it on escape
if (event->keyval == GDK_Escape &&
/* not main window */ main_window != pThis) {
@@ -438,7 +447,7 @@
cairo_t *cr = gdk_cairo_create (widget->window);
cairo_rectangle (cr, x, y, w, h);
- cairo_set_source_rgb (cr, (0xff/255.0), (0x88)/255.0, 0);
+ cairo_set_source_rgb (cr, 0xff/255.0, 0x88/255.0, 0);
cairo_fill (cr);
cairo_destroy (cr);
return FALSE;
@@ -563,10 +572,7 @@
}
YDialog *YGWidgetFactory::createDialog (YDialogType dialogType, YDialogColorMode colorMode)
-{
- IMPL
- return new YGDialog (dialogType, colorMode);
-}
+{ return new YGDialog (dialogType, colorMode); }
YEvent *YGDialog::waitForEventInternal (int timeout_millisec)
{ return YGUI::ui()->waitInput (timeout_millisec, true); }
Modified: trunk/gtk/src/YGDumbTab.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDumbTab.cc?rev=59804&r…
==============================================================================
--- trunk/gtk/src/YGDumbTab.cc (original)
+++ trunk/gtk/src/YGDumbTab.cc Thu Nov 26 18:14:14 2009
@@ -2,8 +2,9 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
-#include <YGUI.h>
+#define YUILogComponent "gtk"
+#include "config.h"
+#include "YGUI.h"
#include "YGWidget.h"
#include "YGUtils.h"
#include "YDumbTab.h"
@@ -20,10 +21,9 @@
: YDumbTab (NULL),
YGWidget (this, parent, GTK_TYPE_NOTEBOOK, NULL)
{
- IMPL
m_containee = gtk_event_box_new();
- gtk_widget_show (m_containee);
g_object_ref_sink (G_OBJECT (m_containee));
+ gtk_widget_show (m_containee);
m_last_tab = 0;
// GTK+ keeps the notebook size set to the biggset page. We can't
@@ -34,9 +34,8 @@
connect (getWidget(), "switch-page", G_CALLBACK (changed_tab_cb), this);
}
- ~YGDumbTab()
+ virtual ~YGDumbTab()
{
- IMPL
gtk_widget_destroy (m_containee);
g_object_unref (G_OBJECT (m_containee));
}
@@ -84,11 +83,11 @@
virtual void deleteAllItems()
{
- YDumbTab::deleteAllItems();
GList *children = gtk_container_get_children (GTK_CONTAINER (getWidget()));
for (GList *i = children; i; i = i->next)
gtk_container_remove (GTK_CONTAINER (getWidget()), (GtkWidget *) i->data);
g_list_free (children);
+ YDumbTab::deleteAllItems();
}
// to re-use the same widget in all tabs (m_fixed), we will remove and
@@ -100,15 +99,12 @@
GtkNotebook *notebook = GTK_NOTEBOOK (getWidget());
int nb = gtk_notebook_get_current_page (notebook);
- GtkWidget *tab = gtk_notebook_get_nth_page (notebook, nb);
-
- gtk_container_add (GTK_CONTAINER (tab), m_containee);
- m_last_tab = tab;
+ m_last_tab = gtk_notebook_get_nth_page (notebook, nb);
+ gtk_container_add (GTK_CONTAINER (m_last_tab), m_containee);
}
virtual YItem *selectedItem()
{
- IMPL
GtkNotebook *notebook = GTK_NOTEBOOK (getWidget());
int nb = gtk_notebook_get_current_page (notebook);
if (nb < 0) return NULL;
@@ -126,6 +122,7 @@
gtk_notebook_set_current_page (GTK_NOTEBOOK (getWidget()), page);
syncTabPage();
}
+ YDumbTab::selectItem (item, selected);
}
virtual void shortcutChanged()
@@ -150,6 +147,7 @@
GtkWidget *child = gtk_notebook_get_nth_page (notebook, tab_nb);
YItem *item = (YItem *) g_object_get_data (G_OBJECT (child), "yitem");
+ pThis->YDumbTab::selectItem (item);
YGUI::ui()->sendEvent (new YMenuEvent (item));
pThis->syncTabPage();
}
@@ -158,8 +156,5 @@
};
YDumbTab *YGOptionalWidgetFactory::createDumbTab (YWidget *parent)
-{
- IMPL
- return new YGDumbTab (parent);
-}
+{ return new YGDumbTab (parent); }
Modified: trunk/gtk/src/YGFrame.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGFrame.cc?rev=59804&r1=…
==============================================================================
--- trunk/gtk/src/YGFrame.cc (original)
+++ trunk/gtk/src/YGFrame.cc Thu Nov 26 18:14:14 2009
@@ -2,7 +2,8 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
+#define YUILogComponent "gtk"
+#include "config.h"
#include "YGUI.h"
#include "YGWidget.h"
#include "YGUtils.h"
@@ -20,9 +21,8 @@
public:
YGBaseFrame (YWidget *ywidget, YWidget *parent)
: YGWidget (ywidget, parent,
- GTK_TYPE_FRAME, "shadow-type", GTK_SHADOW_NONE, NULL)
+ GTK_TYPE_FRAME, /*"shadow-type", GTK_SHADOW_NONE, */NULL)
{
- IMPL
m_containee = gtk_alignment_new (0, 0, 1, 1);
gtk_alignment_set_padding (GTK_ALIGNMENT (m_containee),
0, 0, CHILD_INDENTATION, 0);
@@ -87,10 +87,8 @@
}
// YFrame
-
virtual void setLabel (const string &_str)
{
- IMPL
GtkWidget *label = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
string str (YGUtils::mapKBAccel (_str));
gtk_label_set_text_with_mnemonic (GTK_LABEL (label), str.c_str());
@@ -100,17 +98,13 @@
YGWIDGET_IMPL_CONTAINER (YFrame)
// YGWidget
-
virtual string getDebugLabel() const
{ return label(); }
};
YFrame *YGWidgetFactory::createFrame (YWidget *parent, const string &label)
-{
- IMPL
- return new YGFrame (parent, label);
-}
+{ return new YGFrame (parent, label); }
#include "YCheckBoxFrame.h"
@@ -121,7 +115,6 @@
: YCheckBoxFrame (NULL, label, checked),
YGBaseFrame (this, parent)
{
- IMPL
GtkWidget *button = gtk_check_button_new_with_mnemonic("");
YGUtils::setWidgetFont (gtk_bin_get_child (GTK_BIN (button)), PANGO_STYLE_NORMAL,
PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
@@ -134,7 +127,6 @@
}
// YCheckBoxFrame
-
virtual void setLabel (const string &_str)
{
GtkWidget *button = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
@@ -159,7 +151,6 @@
}
// YGWidget
-
virtual void doSetEnabled (bool enabled)
{
GtkWidget *frame = getWidget();
@@ -185,10 +176,7 @@
}
};
-YCheckBoxFrame *YGWidgetFactory::createCheckBoxFrame (YWidget *parent, const string &label,
- bool checked)
-{
- IMPL
- return new YGCheckBoxFrame (parent, label, checked);
-}
+YCheckBoxFrame *YGWidgetFactory::createCheckBoxFrame (
+ YWidget *parent, const string &label, bool checked)
+{ return new YGCheckBoxFrame (parent, label, checked); }
Modified: trunk/gtk/src/YGImage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGImage.cc?rev=59804&r1=…
==============================================================================
--- trunk/gtk/src/YGImage.cc (original)
+++ trunk/gtk/src/YGImage.cc Thu Nov 26 18:14:14 2009
@@ -2,15 +2,16 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
+#define YUILogComponent "gtk"
+#include "config.h"
#include "ygdkmngloader.h"
-#include <config.h>
#include "YGUI.h"
#include "YGWidget.h"
#include "YImage.h"
#include "ygtkimage.h"
#include <string.h>
-static bool endsWith (const std::string &str1, const char *str2)
+static inline bool endsWith (const std::string &str1, const char *str2)
{
size_t len = strlen (str2);
if (str1.size() < len) return false;
@@ -24,7 +25,6 @@
: YImage (NULL, filename, animated),
YGWidget (this, parent, YGTK_TYPE_IMAGE, NULL)
{
- IMPL
YGtkImage *image = YGTK_IMAGE (getWidget());
const char *stock = NULL;
if (endsWith (filename, "/msg_question.png"))
@@ -55,7 +55,5 @@
};
YImage *YGWidgetFactory::createImage (YWidget *parent, const string &filename, bool animated)
-{
- return new YGImage (parent, filename, animated);
-}
+{ return new YGImage (parent, filename, animated); }
Modified: trunk/gtk/src/YGInputField.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGInputField.cc?rev=5980…
==============================================================================
--- trunk/gtk/src/YGInputField.cc (original)
+++ trunk/gtk/src/YGInputField.cc Thu Nov 26 18:14:14 2009
@@ -2,8 +2,9 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
-#include <YGUI.h>
+#define YUILogComponent "gtk"
+#include "config.h"
+#include "YGUI.h"
#include "YGWidget.h"
#include "YGUtils.h"
#include "ygtkfieldentry.h"
@@ -95,7 +96,6 @@
YGLabeledWidget (this, parent, label, YD_HORIZ,
YGTK_TYPE_FIELD_ENTRY, NULL)
{
- IMPL
YGtkFieldEntry *field = YGTK_FIELD_ENTRY (getWidget());
ygtk_field_entry_add_field (field, ':');
ygtk_field_entry_add_field (field, ':');
@@ -120,7 +120,6 @@
virtual string value()
{
- IMPL
const gchar *hours, *mins;
YGtkFieldEntry *entry = YGTK_FIELD_ENTRY (getWidget());
hours = ygtk_field_entry_get_field_text (entry, 0);
@@ -141,10 +140,7 @@
};
YTimeField *YGOptionalWidgetFactory::createTimeField (YWidget *parent, const string &label)
-{
- IMPL
- return new YGTimeField (parent, label);
-}
+{ return new YGTimeField (parent, label); }
#include "YDateField.h"
#include "ygtkmenubutton.h"
@@ -158,7 +154,6 @@
: YDateField (NULL, label),
YGLabeledWidget (this, parent, label, YD_HORIZ, YGTK_TYPE_FIELD_ENTRY, NULL)
{
- IMPL
ygtk_field_entry_add_field (getField(), '-');
ygtk_field_entry_add_field (getField(), '-');
ygtk_field_entry_add_field (getField(), '-');
@@ -204,7 +199,6 @@
virtual string value()
{
- IMPL
const gchar *year, *month, *day;
year = ygtk_field_entry_get_field_text (getField(), 0);
month = ygtk_field_entry_get_field_text (getField(), 1);
@@ -280,10 +274,7 @@
};
YDateField *YGOptionalWidgetFactory::createDateField (YWidget *parent, const string &label)
-{
- IMPL
- return new YGDateField (parent, label);
-}
+{ return new YGDateField (parent, label); }
#include "YTimezoneSelector.h"
#include "ygtktimezonepicker.h"
@@ -296,7 +287,6 @@
: YTimezoneSelector (NULL, pixmap, timezones),
YGWidget (this, parent, YGTK_TYPE_TIME_ZONE_PICKER, NULL)
{
- IMPL
setStretchable (YD_HORIZ, true);
setStretchable (YD_VERT, true);
ygtk_time_zone_picker_set_map (YGTK_TIME_ZONE_PICKER (getWidget()),
@@ -345,7 +335,5 @@
YTimezoneSelector *YGOptionalWidgetFactory::createTimezoneSelector (YWidget *parent,
const std::string &pixmap, const std::map <std::string, std::string> &timezones)
-{
- return new YGTimezoneSelector (parent, pixmap, timezones);
-}
+{ return new YGTimezoneSelector (parent, pixmap, timezones); }
Modified: trunk/gtk/src/YGIntField.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGIntField.cc?rev=59804&…
==============================================================================
--- trunk/gtk/src/YGIntField.cc (original)
+++ trunk/gtk/src/YGIntField.cc Thu Nov 26 18:14:14 2009
@@ -2,7 +2,7 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
+#define YUILogComponent "gtk"
#include "YGUI.h"
#include "YGUtils.h"
#include "YGWidget.h"
@@ -114,9 +114,7 @@
YIntField *YGWidgetFactory::createIntField (YWidget *parent, const string &label,
int minValue, int maxValue, int initialValue)
-{
- return new YGIntField (parent, label, minValue, maxValue, initialValue);
-}
+{ return new YGIntField (parent, label, minValue, maxValue, initialValue); }
#include "YSlider.h"
@@ -138,8 +136,5 @@
YSlider *YGOptionalWidgetFactory::createSlider (YWidget *parent, const string &label,
int minValue, int maxValue, int initialValue)
-{
- IMPL
- return new YGSlider (parent, label, minValue, maxValue, initialValue);
-}
+{ return new YGSlider (parent, label, minValue, maxValue, initialValue); }
Modified: trunk/gtk/src/YGLabel.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLabel.cc?rev=59804&r1=…
==============================================================================
--- trunk/gtk/src/YGLabel.cc (original)
+++ trunk/gtk/src/YGLabel.cc Thu Nov 26 18:14:14 2009
@@ -2,35 +2,33 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
-#include <YGUI.h>
+#define YUILogComponent "gtk"
+#include "YGUI.h"
#include "YGUtils.h"
#include "YGWidget.h"
-
#include "YLabel.h"
class YGLabel : public YLabel, public YGWidget
{
public:
- YGLabel (YWidget *parent, const string &text, bool heading, bool outputField)
- : YLabel (NULL, text, heading, outputField),
- YGWidget (this, parent, GTK_TYPE_LABEL, NULL)
+ YGLabel (YWidget *parent, const std::string &text, bool heading, bool outputField)
+ : YLabel (NULL, text, heading, outputField),
+ YGWidget (this, parent, GTK_TYPE_LABEL, NULL)
{
- IMPL
gtk_misc_set_alignment (GTK_MISC (getWidget()), 0.0, 0.5);
if (outputField) {
gtk_label_set_selectable (GTK_LABEL (getWidget()), TRUE);
gtk_label_set_single_line_mode (GTK_LABEL (getWidget()), TRUE);
YGUtils::setWidgetFont (getWidget(), PANGO_STYLE_ITALIC, PANGO_WEIGHT_NORMAL,
- PANGO_SCALE_MEDIUM);
+ PANGO_SCALE_MEDIUM);
}
if (heading)
YGUtils::setWidgetFont (getWidget(), PANGO_STYLE_NORMAL, PANGO_WEIGHT_BOLD,
- PANGO_SCALE_LARGE);
+ PANGO_SCALE_LARGE);
setLabel (text);
}
- virtual void setText (const string &label)
+ virtual void setText (const std::string &label)
{
YLabel::setText (label);
gtk_label_set_label (GTK_LABEL (getWidget()), label.c_str());
@@ -51,9 +49,7 @@
YGWIDGET_IMPL_USE_BOLD (YLabel)
};
-YLabel *YGWidgetFactory::createLabel (YWidget *parent, const string &text, bool heading,
- bool outputField)
-{
- return new YGLabel (parent, text, heading, outputField);
-}
+YLabel *YGWidgetFactory::createLabel (YWidget *parent,
+ const std::string &text, bool heading, bool outputField)
+{ return new YGLabel (parent, text, heading, outputField); }
Modified: trunk/gtk/src/YGLayout.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLayout.cc?rev=59804&r1…
==============================================================================
--- trunk/gtk/src/YGLayout.cc (original)
+++ trunk/gtk/src/YGLayout.cc Thu Nov 26 18:14:14 2009
@@ -2,7 +2,8 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
+#define YUILogComponent "gtk"
+#include "config.h"
#include "YGWidget.h"
#include "YGUtils.h"
@@ -86,10 +87,7 @@
};
YLayoutBox *YGWidgetFactory::createLayoutBox (YWidget *parent, YUIDimension dimension)
-{
- IMPL
- return new YGLayoutBox (parent, dimension);
-}
+{ return new YGLayoutBox (parent, dimension); }
#if YAST2_VERSION >= 2017006
#include <YButtonBox.h>
@@ -121,10 +119,7 @@
};
YButtonBox *YGWidgetFactory::createButtonBox (YWidget *parent)
-{
- IMPL
- return new YGButtonBox (parent);
-}
+{ return new YGButtonBox (parent); }
#endif
@@ -154,11 +149,11 @@
YGLAYOUT_PREFERRED_SIZE_IMPL (YAlignment)
YGLAYOUT_SET_SIZE_IMPL (YAlignment)
- virtual void setBackgroundPixmap (string filename)
+ virtual void setBackgroundPixmap (const std::string &_filename)
{
+ YAlignment::setBackgroundPixmap (_filename);
// YAlignment will prepend a path to the image
- YAlignment::setBackgroundPixmap (filename);
- filename = YAlignment::backgroundPixmap();
+ std::string filename (YAlignment::backgroundPixmap());
if (m_background_pixbuf)
g_object_unref (G_OBJECT (m_background_pixbuf));
@@ -202,10 +197,7 @@
YAlignment *YGWidgetFactory::createAlignment (YWidget *parent, YAlignmentType halign,
YAlignmentType valign)
-{
- IMPL
- return new YGAlignment (parent, halign, valign);
-}
+{ return new YGAlignment (parent, halign, valign); }
#include <YEmpty.h>
@@ -224,10 +216,7 @@
};
YEmpty *YGWidgetFactory::createEmpty (YWidget *parent)
-{
- IMPL
- return new YGEmpty (parent);
-}
+{ return new YGEmpty (parent); }
#include <YSpacing.h>
@@ -272,9 +261,7 @@
};
YReplacePoint *YGWidgetFactory::createReplacePoint (YWidget *parent)
-{
- return new YGReplacePoint (parent);
-}
+{ return new YGReplacePoint (parent); }
#include <YSquash.h>
@@ -294,8 +281,5 @@
};
YSquash *YGWidgetFactory::createSquash (YWidget *parent, bool hsquash, bool vsquash)
-{
- IMPL
- return new YGSquash (parent, hsquash, vsquash);
-}
+{ return new YGSquash (parent, hsquash, vsquash); }
Modified: trunk/gtk/src/YGMenuButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGMenuButton.cc?rev=5980…
==============================================================================
--- trunk/gtk/src/YGMenuButton.cc (original)
+++ trunk/gtk/src/YGMenuButton.cc Thu Nov 26 18:14:14 2009
@@ -2,13 +2,53 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
-#include <YGUI.h>
+#define YUILogComponent "gtk"
+#include "config.h"
+#include "YGUI.h"
#include "YGUtils.h"
#include "YGWidget.h"
#include "YMenuButton.h"
#include "ygtkmenubutton.h"
+static void selected_item_cb (GtkMenuItem *menuitem, YItem *item)
+{
+ YGUI::ui()->sendEvent (new YMenuEvent (item));
+}
+
+static void doCreateMenu (GtkWidget *parent, YItemIterator begin, YItemIterator end)
+{
+ for (YItemIterator it = begin; it != end; it++) {
+ GtkWidget *entry, *image = 0;
+ string str = YGUtils::mapKBAccel ((*it)->label());
+
+ if ((*it)->hasIconName()) {
+ GdkPixbuf *pixbuf = YGUtils::loadPixbuf ((*it)->iconName());
+ if (pixbuf) {
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ g_object_unref (G_OBJECT (pixbuf));
+ }
+ }
+
+ if (image) {
+ entry = gtk_image_menu_item_new_with_mnemonic (str.c_str());
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (entry), image);
+ }
+ else
+ entry = gtk_menu_item_new_with_mnemonic (str.c_str());
+
+ gtk_menu_shell_append (GTK_MENU_SHELL (parent), entry);
+
+ if ((*it)->hasChildren()) {
+ GtkWidget *submenu = gtk_menu_new();
+ doCreateMenu (submenu, (*it)->childrenBegin(), (*it)->childrenEnd());
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (entry), submenu);
+ }
+ else
+ g_signal_connect (G_OBJECT (entry), "activate",
+ G_CALLBACK (selected_item_cb), *it);
+ }
+}
+
class YGMenuButton : public YMenuButton, public YGWidget
{
public:
@@ -16,7 +56,6 @@
: YMenuButton (NULL, label),
YGWidget (this, parent, YGTK_TYPE_MENU_BUTTON, NULL)
{
- IMPL
string str = YGUtils::mapKBAccel (label.c_str());
ygtk_menu_button_set_label (YGTK_MENU_BUTTON (getWidget()), str.c_str());
}
@@ -24,56 +63,52 @@
// YMenuButton
virtual void rebuildMenuTree()
{
- GtkWidget *menu = doCreateMenu (itemsBegin(), itemsEnd());
+ GtkWidget *menu = gtk_menu_new();
+ doCreateMenu (menu, itemsBegin(), itemsEnd());
gtk_widget_show_all (menu);
ygtk_menu_button_set_popup (YGTK_MENU_BUTTON (getWidget()), menu);
}
- static GtkWidget* doCreateMenu (YItemIterator begin, YItemIterator end)
- {
- GtkWidget *menu = gtk_menu_new();
- for (YItemIterator it = begin; it != end; it++) {
- GtkWidget *entry, *image = 0;
- string str = YGUtils::mapKBAccel ((*it)->label());
-
- if ((*it)->hasIconName()) {
- GdkPixbuf *pixbuf = YGUtils::loadPixbuf ((*it)->iconName());
- if (pixbuf) {
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref (G_OBJECT (pixbuf));
- }
- }
-
- if (image) {
- entry = gtk_image_menu_item_new_with_mnemonic (str.c_str());
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (entry), image);
- }
- else
- entry = gtk_menu_item_new_with_mnemonic (str.c_str());
+ YGWIDGET_IMPL_COMMON (YMenuButton)
+};
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), entry);
+YMenuButton *YGWidgetFactory::createMenuButton (YWidget *parent, const string &label)
+{ return new YGMenuButton (parent, label); }
- if ((*it)->hasChildren())
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (entry),
- doCreateMenu ((*it)->childrenBegin(), (*it)->childrenEnd()));
- else
- g_signal_connect (G_OBJECT (entry), "activate",
- G_CALLBACK (selected_item_cb), *it);
- }
+#if YAST2_VERSION > 2018003
+#include <YContextMenu.h>
- return menu;
+class YGContextMenu : public YContextMenu, public YGWidget
+{
+public:
+ YGContextMenu()
+ : YContextMenu(),
+ YGWidget (this, NULL, GTK_TYPE_MENU, NULL)
+ {
+ connect (getWidget(), "cancel", G_CALLBACK (cancel_cb), this);
}
- static void selected_item_cb (GtkMenuItem *menuitem, YItem *item)
+ // YContextMenu
+ virtual void rebuildMenuTree()
{
- YGUI::ui()->sendEvent (new YMenuEvent (item));
+ GtkWidget *menu = getWidget();
+ doCreateMenu (menu, itemsBegin(), itemsEnd());
+ gtk_widget_show_all (menu);
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 3, gtk_get_current_event_time());
}
- YGWIDGET_IMPL_COMMON (YMenuButton)
+ // callbacks
+ static void cancel_cb (GtkMenuShell *menu, YGContextMenu *pThis)
+ { YGUI::ui()->sendEvent (new YCancelEvent()); }
+
+ YGWIDGET_IMPL_COMMON (YContextMenu)
};
-YMenuButton *YGWidgetFactory::createMenuButton (YWidget *parent, const string &label)
+bool YGApplication::openContextMenu (const YItemCollection &itemCollection)
{
- return new YGMenuButton (parent, label);
+ YGContextMenu *menu = new YGContextMenu();
+ menu->addItems (itemCollection);
+ return true;
}
+#endif
Modified: trunk/gtk/src/YGProgressBar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGProgressBar.cc?rev=598…
==============================================================================
--- trunk/gtk/src/YGProgressBar.cc (original)
+++ trunk/gtk/src/YGProgressBar.cc Thu Nov 26 18:14:14 2009
@@ -6,8 +6,9 @@
Textdomain "yast2-gtk"
*/
-#include <config.h>
-#include <YGUI.h>
+#define YUILogComponent "gtk"
+#include "config.h"
+#include "YGUI.h"
#include "YGWidget.h"
#include "YGi18n.h"
@@ -51,7 +52,6 @@
// YProgressBar
virtual void setValue (int value)
{
- IMPL
YProgressBar::setValue (value);
GtkProgressBar *bar = GTK_PROGRESS_BAR (getWidget());
float fraction = CLAMP ((float) value / maxValue(), 0, 1);
@@ -121,10 +121,7 @@
YDownloadProgress *YGOptionalWidgetFactory::createDownloadProgress (YWidget *parent,
const string &label, const string &filename, YFileSize_t expectedFileSize)
-{
- IMPL
- return new YGDownloadProgress (parent, label, filename, expectedFileSize);
-}
+{ return new YGDownloadProgress (parent, label, filename, expectedFileSize); }
#include "ygtkratiobox.h"
#include "YMultiProgressMeter.h"
@@ -187,9 +184,7 @@
YMultiProgressMeter *YGOptionalWidgetFactory::createMultiProgressMeter (YWidget *parent,
YUIDimension dim, const vector <float> &maxValues)
-{
- return new YGMultiProgressMeter (parent, dim, maxValues);
-}
+{ return new YGMultiProgressMeter (parent, dim, maxValues); }
#include "YBusyIndicator.h"
@@ -258,8 +253,5 @@
};
YBusyIndicator *YGWidgetFactory::createBusyIndicator (YWidget *parent, const string &label, int timeout)
-{
- IMPL
- return new YGBusyIndicator (parent, label, timeout);
-}
+{ return new YGBusyIndicator (parent, label, timeout); }
Modified: trunk/gtk/src/YGPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPushButton.cc?rev=5980…
==============================================================================
--- trunk/gtk/src/YGPushButton.cc (original)
+++ trunk/gtk/src/YGPushButton.cc Thu Nov 26 18:14:14 2009
@@ -2,8 +2,9 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
-#include <YGUI.h>
+#define YUILogComponent "gtk"
+#include "config.h"
+#include "YGUI.h"
#include <YPushButton.h>
#include "YGUtils.h"
#include "YGWidget.h"
@@ -19,12 +20,10 @@
: YPushButton (NULL, label),
YGWidget (this, parent, GTK_TYPE_BUTTON, "can-default", TRUE, NULL)
{
- IMPL
m_customIcon = m_labelIcon = false;
gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE);
setLabel (label);
connect (getWidget(), "clicked", G_CALLBACK (clicked_cb), this);
- g_signal_connect (G_OBJECT (getWidget()), "expose-event", G_CALLBACK (treat_icon_cb), this);
}
void setStockIcon (const std::string &label)
@@ -41,7 +40,7 @@
case 7: stock = GTK_STOCK_PREFERENCES; break; // Expert
case 8: stock = GTK_STOCK_GO_BACK; break;
case 9: stock = GTK_STOCK_CANCEL; break;
-// case 10: stock = GTK_STOCK_GO_FORWARD; break;
+ case 10: stock = GTK_STOCK_OK; break; // Next/Finish/OK
default: break;
}
#if YAST2_VERSION >= 2017006
@@ -60,7 +59,6 @@
// YPushButton
virtual void setLabel (const string &label)
{
- IMPL
YPushButton::setLabel (label);
string str = YGUtils::mapKBAccel (label);
gtk_button_set_label (GTK_BUTTON (getWidget()), str.c_str());
@@ -92,7 +90,6 @@
virtual void setIcon (const string &icon)
{
- IMPL
GtkButton *button = GTK_BUTTON (getWidget());
if (icon.empty()) {
m_customIcon = false;
@@ -149,7 +146,7 @@
}
return true;
}
-#if 1
+#if 0
static gboolean treat_icon_cb (GtkWidget *widget, GdkEventExpose *event,
YGPushButton *pThis)
{
@@ -201,7 +198,5 @@
};
YPushButton *YGWidgetFactory::createPushButton (YWidget *parent, const string &label)
-{
- return new YGPushButton (parent, label);
-}
+{ return new YGPushButton (parent, label); }
Modified: trunk/gtk/src/YGRadioButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGRadioButton.cc?rev=598…
==============================================================================
--- trunk/gtk/src/YGRadioButton.cc (original)
+++ trunk/gtk/src/YGRadioButton.cc Thu Nov 26 18:14:14 2009
@@ -2,7 +2,8 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
+#define YUILogComponent "gtk"
+#include "config.h"
#include "YGUI.h"
#include "YGUtils.h"
#include "YGWidget.h"
@@ -51,7 +52,6 @@
: YRadioButton (NULL, label),
YGWidget (this, parent, getCheckRadioButtonType(), NULL)
{
- IMPL
if (!is_horizontal_box (parent))
setStretchable (YD_HORIZ, true);
setLabel (label);
@@ -66,21 +66,16 @@
{
// NOTE: we can't just set a gtk_widget_modify() at the initialization
// because each gtk_button_set_label() creates a new label
- IMPL
string str = YGUtils::mapKBAccel(text.c_str());
gtk_button_set_label (GTK_BUTTON (getWidget()), str.c_str());
YRadioButton::setLabel (text);
}
virtual bool value()
- {
- IMPL
- return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (getWidget()));
- }
+ { return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (getWidget())); }
virtual void setValue (bool checked)
{
- IMPL
BlockEvents block (this);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (getWidget()), checked);
if (checked) {
@@ -105,7 +100,6 @@
YRadioButton *YGWidgetFactory::createRadioButton (YWidget *parent, const string &label,
bool isChecked)
{
- IMPL
YRadioButton *button = new YGRadioButton (parent, label, isChecked);
// libyui instructs us to do it here due to vfuncs craziness
@@ -145,7 +139,6 @@
: YCheckBox (NULL, label),
YGWidget (this, parent, GTK_TYPE_CHECK_BUTTON, NULL)
{
- IMPL
if (!is_horizontal_box (parent))
setStretchable (YD_HORIZ, true);
setLabel (label);
@@ -158,7 +151,6 @@
// YCheckButton
virtual void setLabel (const string &text)
{
- IMPL
string str = YGUtils::mapKBAccel(text);
gtk_button_set_label (GTK_BUTTON (getWidget()), str.c_str());
YCheckBox::setLabel (text);
@@ -166,7 +158,6 @@
virtual YCheckBoxState value()
{
- IMPL
GtkToggleButton *button = GTK_TOGGLE_BUTTON (getWidget());
if (gtk_toggle_button_get_inconsistent (button))
@@ -176,7 +167,6 @@
virtual void setValue (YCheckBoxState value)
{
- IMPL
BlockEvents block (this);
GtkToggleButton *button = GTK_TOGGLE_BUTTON (getWidget());
switch (value) {
@@ -208,8 +198,5 @@
YCheckBox *YGWidgetFactory::createCheckBox (YWidget *parent, const string &label,
bool isChecked)
-{
- IMPL
- return new YGCheckBox (parent, label, isChecked);
-}
+{ return new YGCheckBox (parent, label, isChecked); }
Modified: trunk/gtk/src/YGSelectionModel.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionModel.cc?rev=…
==============================================================================
--- trunk/gtk/src/YGSelectionModel.cc (original)
+++ trunk/gtk/src/YGSelectionModel.cc Thu Nov 26 18:14:14 2009
@@ -2,7 +2,8 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
+#define YUILogComponent "gtk"
+#include "config.h"
#include <gtk/gtk.h>
#include <YTreeItem.h>
#include "YGSelectionModel.h"
Modified: trunk/gtk/src/YGTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTable.cc?rev=59804&r1=…
==============================================================================
--- trunk/gtk/src/YGTable.cc (original)
+++ trunk/gtk/src/YGTable.cc Thu Nov 26 18:14:14 2009
@@ -2,22 +2,22 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
-#include <YGUI.h>
+#define YUILogComponent "gtk"
+#include "config.h"
+#include "YGUI.h"
#include "YGUtils.h"
#include "YGWidget.h"
#include "YSelectionWidget.h"
#include "YGSelectionModel.h"
#include "ygtkcellrenderertextpixbuf.h"
-#include "ygtkscrolledwindow.h"
-#include <time.h>
+#include "ygtktreeview.h"
/* A generic widget for table related widgets. */
class YGTableView : public YGScrolledWidget, public YGSelectionModel
{
protected:
int m_colsNb;
- time_t m_blockTime; // GtkTreeSelection signals act weird
+ guint m_blockTimeout;
public:
YGTableView (YWidget *ywidget, YWidget *parent, const string &label,
@@ -26,8 +26,6 @@
YGTK_TYPE_TREE_VIEW, NULL)
, YGSelectionModel ((YSelectionWidget *) ywidget, ordinaryModel, isTree)
{
- IMPL
- m_blockTime = time (NULL);
if (ordinaryModel) {
appendIconTextColumn ("", YAlignUnchanged, YGSelectionModel::ICON_COLUMN,
YGSelectionModel::LABEL_COLUMN);
@@ -41,6 +39,14 @@
gtk_tree_selection_set_mode (getSelection(), GTK_SELECTION_BROWSE);
// let the derivates do the event hooks. They have subtile differences.
+
+ m_blockTimeout = 0; // GtkTreeSelection idiotically fires when showing widget
+ g_signal_connect (getWidget(), "map", G_CALLBACK (block_init_cb), this);
+ }
+
+ virtual ~YGTableView()
+ {
+ if (m_blockTimeout) g_source_remove (m_blockTimeout);
}
inline GtkTreeView *getView()
@@ -50,7 +56,6 @@
void appendIconTextColumn (string header, YAlignmentType align, int icon_col, int text_col)
{
- IMPL
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
@@ -108,12 +113,24 @@
virtual bool immediateEvent() { return true; }
- // YGSelectionModel
+ static gboolean block_selected_timeout_cb (gpointer data)
+ {
+ YGTableView *pThis = (YGTableView *) data;
+ pThis->m_blockTimeout = 0;
+ return FALSE;
+ }
+ void blockSelected()
+ { // GtkTreeSelection only fires when idle; so set a timeout
+ if (m_blockTimeout) g_source_remove (m_blockTimeout);
+ m_blockTimeout = g_timeout_add_full (G_PRIORITY_LOW, 250, block_selected_timeout_cb, this, NULL);
+ }
+
+ // YGSelectionModel
virtual void doSelectItem (GtkTreeIter *iter)
{
if (!gtk_tree_selection_iter_is_selected (getSelection(), iter)) {
- m_blockTime = time (NULL);
+ blockSelected();
GtkTreePath *path = gtk_tree_model_get_path (getModel(), iter);
gtk_tree_view_expand_to_path (getView(), path);
@@ -128,7 +145,7 @@
virtual void doUnselectAll()
{
if (gtk_tree_selection_count_selected_rows (getSelection())) {
- m_blockTime = time (NULL);
+ blockSelected();
gtk_tree_selection_unselect_all (getSelection());
}
}
@@ -156,10 +173,13 @@
return 80;
}
+ // GTK callbacks
+ static void block_init_cb (GtkWidget *widget, YGTableView *pThis)
+ { pThis->blockSelected(); }
+
// toggled by user (through clicking on the renderer or some other action)
void toggle (GtkTreePath *path, gint column)
{
- IMPL
GtkTreeIter iter;
if (!gtk_tree_model_get_iter (getModel(), &iter, path))
return;
@@ -174,7 +194,7 @@
static void selection_changed_cb (GtkTreeSelection *selection, YGTableView *pThis)
{
- if (time (NULL) - pThis->m_blockTime <= 2)
+ if (pThis->m_blockTimeout)
return;
if (!pThis->toggleMode()) {
GtkTreeSelection *selection = pThis->getSelection();
@@ -199,12 +219,18 @@
static void toggled_cb (GtkCellRendererToggle *renderer, gchar *path_str,
YGTableView *pThis)
{
- IMPL
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (renderer), "column"));
pThis->toggle (path, column);
gtk_tree_path_free (path);
}
+
+#if YAST2_VERSION > 2018003
+ static void right_click_cb (YGtkTreeView *view, gboolean outreach, YGTableView *pThis)
+ {
+ pThis->emitEvent (YEvent::ContextMenuActivated);
+ }
+#endif
};
#include "YTable.h"
@@ -223,7 +249,6 @@
#endif
, YGTableView (this, parent, string(), false, false)
{
- IMPL
gtk_tree_view_set_headers_visible (getView(), TRUE);
gtk_tree_view_set_rules_hint (getView(), columns() > 1);
#if YAST2_VERSION >= 2017005
@@ -250,7 +275,7 @@
connect (getWidget(), "row-activated", G_CALLBACK (activated_cb), (YGTableView *) this);
connect (getSelection(), "changed", G_CALLBACK (selection_changed_cb), (YGTableView *) this);
- connect (getWidget(), "right-click", G_CALLBACK (right_click_cb), this);
+ connect (getWidget(), "right-click", G_CALLBACK (hack_right_click_cb), this);
connect (getWidget(), "key-press-event", G_CALLBACK (key_press_event_cb), this);
}
@@ -284,7 +309,6 @@
void setSortable (bool sortable)
{
- IMPL
if (!sortable && !GTK_WIDGET_REALIZED (getWidget()))
return;
int n = 0;
@@ -342,8 +366,12 @@
YGUI::ui()->sendEvent (event);
}
- static void right_click_cb (YGtkTreeView *view, gboolean outreach, YGTable *pThis)
+ static void hack_right_click_cb (YGtkTreeView *view, gboolean outreach, YGTable *pThis)
{
+#if YAST2_VERSION > 2018003
+ if (pThis->notifyContextMenu())
+ return YGTableView::right_click_cb (view, outreach, pThis);
+#endif
if (!YGDialog::currentDialog()->getFunctionWidget (5) ||
// undetermined case -- more than one table exists
YGDialog::currentDialog()->getClassWidgets ("YTable").size() > 1) {
@@ -416,6 +444,9 @@
{
connect (getWidget(), "row-activated", G_CALLBACK (activated_cb), (YGTableView *) this);
connect (getSelection(), "changed", G_CALLBACK (selection_changed_cb), (YGTableView *) this);
+#if YAST2_VERSION > 2018003
+ connect (getWidget(), "right-click", G_CALLBACK (right_click_cb), this);
+#endif
}
virtual bool isShrinkable() { return shrinkable(); }
@@ -425,10 +456,7 @@
};
YSelectionBox *YGWidgetFactory::createSelectionBox (YWidget *parent, const string &label)
-{
- IMPL
- return new YGSelectionBox (parent, label);
-}
+{ return new YGSelectionBox (parent, label); }
#include "YMultiSelectionBox.h"
@@ -446,11 +474,15 @@
createModel (types);
appendCheckColumn ("", 0);
appendIconTextColumn ("", YAlignUnchanged, 1, 2);
+ gtk_tree_view_set_search_column (getView(), 2);
setModel();
connect (getSelection(), "changed", G_CALLBACK (selection_changed_cb), (YGTableView *) this);
// Let the user toggle, using space/enter or double click (not an event).
connect (getWidget(), "row-activated", G_CALLBACK (multi_activated_cb), this);
+#if YAST2_VERSION > 2018003
+ connect (getWidget(), "right-click", G_CALLBACK (right_click_cb), this);
+#endif
}
// YMultiSelectionBox
@@ -483,7 +515,6 @@
{ pThis->toggle (path, 0); }
// YGSelectionModel
-
virtual void doSelectItem (GtkTreeIter *iter)
{
setCellToggle (iter, 0, true);
@@ -500,18 +531,13 @@
}
// YGWidget
-
virtual bool isShrinkable() { return shrinkable(); }
YGWIDGET_IMPL_COMMON (YMultiSelectionBox)
YGSELECTION_WIDGET_IMPL (YMultiSelectionBox)
};
-YMultiSelectionBox *YGWidgetFactory::createMultiSelectionBox (YWidget *parent,
- const string &label)
-{
- IMPL
- return new YGMultiSelectionBox (parent, label);
-}
+YMultiSelectionBox *YGWidgetFactory::createMultiSelectionBox (YWidget *parent, const string &label)
+{ return new YGMultiSelectionBox (parent, label); }
#include "YTree.h"
#include "YTreeItem.h"
@@ -527,6 +553,9 @@
connect (getWidget(), "row-expanded", G_CALLBACK (row_expanded_cb), this);
connect (getWidget(), "cursor-changed", G_CALLBACK (row_selected_cb), this);
connect (getWidget(), "row-activated", G_CALLBACK (activated_cb), (YGTableView *) this);
+#if YAST2_VERSION > 2018003
+ connect (getWidget(), "right-click", G_CALLBACK (right_click_cb), this);
+#endif
}
// YTree
@@ -596,7 +625,7 @@
GtkTreeIter iter;
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
pThis->expand (&iter);
- YGTableView::selection_changed_cb (selection, pThis);
+ YGTable::selection_changed_cb (selection, pThis);
}
virtual unsigned int getMinSize (YUIDimension dim)
Modified: trunk/gtk/src/YGText.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGText.cc?rev=59804&r1=5…
==============================================================================
--- trunk/gtk/src/YGText.cc (original)
+++ trunk/gtk/src/YGText.cc Thu Nov 26 18:14:14 2009
@@ -2,8 +2,9 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
-#include <YGUI.h>
+#define YUILogComponent "gtk"
+#include "config.h"
+#include "YGUI.h"
#include <string>
#include "YGUtils.h"
#include "YGWidget.h"
@@ -19,7 +20,6 @@
YGTK_TYPE_TEXT_VIEW, "wrap-mode", GTK_WRAP_WORD_CHAR,
"editable", editable, NULL)
{
- IMPL
setPolicy (GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
maxChars = -1;
connect (getBuffer(), "changed", G_CALLBACK (text_changed_cb), this);
@@ -29,14 +29,10 @@
{ return gtk_text_view_get_buffer (GTK_TEXT_VIEW (getWidget())); }
int getCharsNb()
- {
- IMPL
- return gtk_text_buffer_get_char_count (getBuffer());
- }
+ { return gtk_text_buffer_get_char_count (getBuffer()); }
void setCharsNb (int max_chars)
{
- IMPL
maxChars = max_chars;
if (maxChars != -1 && getCharsNb() > maxChars)
truncateText (maxChars);
@@ -53,19 +49,17 @@
void setText (const string &text)
{
- IMPL
BlockEvents block (this);
gtk_text_buffer_set_text (getBuffer(), text.c_str(), -1);
}
- string getText()
+ std::string getText()
{
- IMPL
GtkTextIter start_it, end_it;
gtk_text_buffer_get_bounds (getBuffer(), &start_it, &end_it);
gchar* text = gtk_text_buffer_get_text (getBuffer(), &start_it, &end_it, FALSE);
- string str (text);
+ std::string str (text);
g_free (text);
return str;
}
@@ -120,11 +114,6 @@
return 30;
}
- virtual void doSetEnabled (bool enabled)
- {
- gtk_text_view_set_editable(GTK_TEXT_VIEW (getWidget()), enabled);
- }
-
YGLABEL_WIDGET_IMPL (YMultiLineEdit)
};
@@ -144,7 +133,6 @@
{}
// YLogView
-
virtual void displayLogText (const string &text)
{
setText (text);
@@ -152,7 +140,6 @@
}
// YGWidget
-
virtual unsigned int getMinSize (YUIDimension dim)
{
if (dim == YD_VERT) {
@@ -181,9 +168,8 @@
: YRichText (NULL, text, plainText)
, YGScrolledWidget (this, parent, ygtk_html_wrap_get_type(), NULL)
{
- IMPL
ygtk_html_wrap_init (getWidget());
- ygtk_html_wrap_connect_link_clicked (getWidget(), G_CALLBACK (link_clicked_cb), this);
+ ygtk_html_wrap_connect_link_clicked (getWidget(), link_clicked_cb, this);
setText (text, plainText);
}
@@ -236,13 +222,10 @@
}
// callbacks
- static void link_clicked_cb (GtkWidget *widget, const char *url, YGRichText *pThis)
- {
- YGUI::ui()->sendEvent (new YMenuEvent (url));
- }
+ static void link_clicked_cb (GtkWidget *widget, const char *url, gpointer data)
+ { YGUI::ui()->sendEvent (new YMenuEvent (url)); }
// YGWidget
-
virtual unsigned int getMinSize (YUIDimension dim)
{ return shrinkable() ? 10 : 100; }
Modified: trunk/gtk/src/YGUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=59804&r1=598…
==============================================================================
--- trunk/gtk/src/YGUI.cc (original)
+++ trunk/gtk/src/YGUI.cc Thu Nov 26 18:14:14 2009
@@ -6,7 +6,6 @@
Textdomain "yast2-gtk"
*/
-#include <config.h>
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>
@@ -34,15 +33,28 @@
#define DEFAULT_MACRO_FILE_NAME "macro.ycp"
#define BUSY_CURSOR_TIMEOUT 250
+YUI *createUI( bool withThreads )
+{
+ static YGUI *ui = 0;
+ if (!ui)
+ ui = new YGUI (withThreads);
+ return ui;
+}
+
YGUI::YGUI (bool with_threads)
: YUI (with_threads), m_done_init (false), busy_timeout (0)
{
- IMPL
m_have_wm = true;
m_no_border = m_fullscreen = false;
+ m_default_width = (m_default_height = 0);
YGUI::setTextdomain( TEXTDOMAIN );
+ // If we're running without threads, initialize Gtk stuff
+ // This enables standalone libyui use Gtk interface
+ if (!with_threads)
+ checkInit();
+
// without this none of the (default) threading action works ...
topmostConstructorHasFinished();
}
@@ -84,7 +96,12 @@
// intern the domain - that can be allocated (or belong to a transient
// plugin's address space).
const char *component = domain ? g_intern_string (domain) : "yast2-gtk";
- YUILog::instance()->log (ylevel, component, "yast2-gtk", 0, "") << message;
+ YUILog::instance()->log (ylevel, component, "yast2-gtk", 0, "") << message << std::endl;
+#if 0 // uncomment to put a stop to gdb
+ static int bugStop = 0;
+ if (bugStop-- <= 0)
+ abort();
+#endif
}
void YGUI::checkInit()
@@ -97,12 +114,11 @@
YCommandLine cmdLine;
int argc = cmdLine.argc();
char **argv = cmdLine.argv();
-
for (int i = 1; i < argc; i++) {
const char *argp = argv[i];
- if (!argp) continue;
if (argp[0] != '-') {
- //printf ("Warning: Unknown argument '%s'\n", argp);
+ if (!strcmp (argp, "sw_single") || !strcmp (argp, "online_update"))
+ YGUI::pkgSelectorSize (&m_default_width, &m_default_height);
continue;
}
argp++;
@@ -116,22 +132,18 @@
m_no_border = true;
else if (!strcmp (argp, "help")) {
printf (
- "Command line options for the YaST2 Gtk UI:\n"
- "\n"
+ "Command line options for the YaST2 Gtk UI:\n\n"
"--no-wm assume no window manager is running\n"
"--noborder no window manager border for main dialogs\n"
"--fullscreen use full screen for main dialogs\n"
-// "--geomtry WxH sets a default size of W per H to main dialogs\n"
+// "--geometry WxH sets a default size of W per H to main dialogs\n"
"--nothreads run without additional UI threads\n"
"--help prints this help text\n"
"\n"
);
exit (0);
}
-/*
- else
- printf ("Warning: Unknown argument '--%s'\n", argp);
-*/
+ else if (pkgSelectorParse (argp)) ;
}
gtk_init (&argc, &argv);
@@ -152,7 +164,6 @@
void YGUI::idleLoop (int fd_ycp)
{
- IMPL
// The rational for this is that we need somewhere to run
// the magic 'main' thread, that can process thread unsafe
// incoming CORBA messages for us
@@ -175,7 +186,6 @@
static gboolean user_input_timeout_cb (YGUI *pThis)
{
- IMPL
if (!pThis->pendingEvent())
pThis->sendEvent (new YTimeoutEvent());
return FALSE;
@@ -184,7 +194,6 @@
// utility that implements both userInput() and pollInput()
YEvent *YGUI::waitInput (unsigned long timeout_ms, bool block)
{
- IMPL
checkInit();
if (!YDialog::currentDialog (false))
return NULL;
@@ -212,8 +221,11 @@
if (timeout)
g_source_remove (timeout);
- if (block) // if YCP keeps working for more than X time, set busy cursor
+ if (block) { // if YCP keeps working for more than X time, set busy cursor
+ if (busy_timeout)
+ g_source_remove (busy_timeout);
busy_timeout = g_timeout_add (BUSY_CURSOR_TIMEOUT, busy_timeout_cb, this);
+ }
return event;
}
@@ -325,14 +337,16 @@
//** YGApplication
+#define ICONDIR THEMEDIR "/icons/22x22/apps/"
+
YGApplication::YGApplication()
{
- setIconBasePath (ICON_DIR);
+ setIconBasePath (ICONDIR);
}
-void YGApplication::makeScreenShot (string filename)
+void YGApplication::makeScreenShot (const std::string &_filename)
{
- IMPL
+ std::string filename (_filename);
bool interactive = filename.empty();
GtkWidget *widget = GTK_WIDGET (YGDialog::currentWindow());
@@ -435,7 +449,6 @@
std::string askForFileOrDirectory (GtkFileChooserAction action,
const std::string &path, const std::string &filter, const std::string &title)
{
- IMPL
GtkWidget *dialog;
dialog = gtk_file_chooser_dialog_new (title.c_str(),
YGDialog::currentWindow(), action, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -499,45 +512,35 @@
std::string YGApplication::askForExistingDirectory (
const std::string &path, const std::string &title)
-{
- IMPL
- return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, path,
- "", title);
-}
+{ return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, path, "", title); }
std::string YGApplication::askForExistingFile (
const std::string &path, const std::string &filter, const std::string &title)
-{
- IMPL
- return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_OPEN, path, filter, title);
-}
+{ return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_OPEN, path, filter, title); }
std::string YGApplication::askForSaveFileName (
const std::string &path, const std::string &filter, const std::string &title)
-{
- IMPL
- return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SAVE, path, filter, title);
-}
+{ return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SAVE, path, filter, title); }
std::string YGApplication::glyph (const std::string &sym)
{
bool reverse = gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL;
if (sym == YUIGlyph_ArrowLeft)
- return reverse ? "\u2192" : "\u2190";
+ return reverse ? "\u25b6" : "\u25c0";
if (sym == YUIGlyph_ArrowRight)
- return reverse ? "\u2190" : "\u2192";
+ return reverse ? "\u25c0" : "\u25b6";
if (sym == YUIGlyph_ArrowUp)
- return "\u2191";
+ return "\u25b2";
if (sym == YUIGlyph_ArrowDown)
- return "\u2193";
+ return "\u25bc";
if (sym == YUIGlyph_CheckMark)
return "\u2714";
if (sym == YUIGlyph_BulletArrowRight)
return reverse ? "\u21e6" : "\u279c";
if (sym == YUIGlyph_BulletCircle)
- return "\u274d";
+ return "\u26ab";
if (sym == YUIGlyph_BulletSquare)
- return "\u274f";
+ return "\u25fe";
return "";
}
@@ -792,7 +795,6 @@
{ gtk_widget_destroy (GTK_WIDGET (dialog)); }
};
- IMPL
GtkWidget *dialog = gtk_dialog_new_with_buttons ("YWidgets HTML", NULL,
GtkDialogFlags (GTK_DIALOG_NO_SEPARATOR), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);
Modified: trunk/gtk/src/YGUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.h?rev=59804&r1=5980…
==============================================================================
--- trunk/gtk/src/YGUI.h (original)
+++ trunk/gtk/src/YGUI.h Thu Nov 26 18:14:14 2009
@@ -5,26 +5,16 @@
#ifndef YGUI_H
#define YGUI_H
-#include <gtk/gtk.h>
-#include <YSimpleEventHandler.h>
-#include <map>
-
+#include "config.h"
+#include <YUI.h>
#define YUILogComponent "gtk"
#include <YUILog.h>
-
-#define ICON_DIR THEMEDIR "/icons/22x22/apps/"
+#include <YSimpleEventHandler.h>
+#include <map>
+#include <gtk/gtk.h>
/* Comment the following line to disable debug messages */
-// #define IMPL_DEBUG
-#define LOC fprintf (stderr, "%s (%s)\n", G_STRLOC, G_STRFUNC)
-#ifdef IMPL_DEBUG
- #define IMPL { LOC; }
-#else
- #define IMPL { }
-#endif
-#define IMPL_RET(a) { IMPL; return (a); }
-
-#include <YUI.h>
+#define RET(a) { return (a); }
class YGUI: public YUI
{
@@ -40,7 +30,7 @@
virtual YApplication *createApplication();
public:
- static void setTextdomain( const char * domain );
+ static void setTextdomain (const char *domain);
virtual void idleLoop (int fd_ycp);
// called by YDialog::waitInput() / pollEvent()...
@@ -74,12 +64,18 @@
// window-related arguments
bool m_have_wm, m_no_border, m_fullscreen;
+ int m_default_width, m_default_height;
+
+ bool pkgSelectorParse (const char *arg);
+ void pkgSelectorSize (int *width, int *height);
public:
// Helpers for internal use [ visibility hidden ]
bool setFullscreen() const { return m_fullscreen; }
bool hasWM() const { return m_have_wm; }
bool unsetBorder() const { return m_no_border; }
+ int defaultWidth() const { return m_default_width; }
+ int defaultHeight() const { return m_default_height; }
};
// debug helpers.
@@ -117,8 +113,7 @@
virtual YMultiSelectionBox *createMultiSelectionBox (YWidget *parent, const string &label);
virtual YPackageSelector *createPackageSelector (YWidget * parent, long ModeFlags);
- virtual YWidget *createPkgSpecial (YWidget * parent, const string & subwidgetName)
- IMPL_RET (NULL) // for ncurses
+ virtual YWidget *createPkgSpecial (YWidget * parent, const string & subwidgetName) RET (NULL) // for ncurses
virtual YLayoutBox *createLayoutBox (YWidget *parent, YUIDimension dimension);
#if YAST2_VERSION >= 2017006
@@ -142,52 +137,52 @@
class YGOptionalWidgetFactory : public YOptionalWidgetFactory
{
public:
- virtual bool hasWizard() IMPL_RET (true)
+ virtual bool hasWizard() RET (true)
virtual YWizard *createWizard (YWidget *parent, const string &backButtonLabel,
const string &abortButtonLabel, const string &nextButtonLabel,
YWizardMode wizardMode);
- virtual bool hasDumbTab() IMPL_RET (true)
+ virtual bool hasDumbTab() RET (true)
virtual YDumbTab *createDumbTab (YWidget *parent);
- virtual bool hasSlider() IMPL_RET (true)
+ virtual bool hasSlider() RET (true)
virtual YSlider *createSlider (YWidget *parent, const string &label, int minVal,
int maxVal, int initialVal);
- virtual bool hasDateField() IMPL_RET (true)
+ virtual bool hasDateField() RET (true)
virtual YDateField *createDateField (YWidget *parent, const string &label);
- virtual bool hasTimeField() IMPL_RET (true)
+ virtual bool hasTimeField() RET (true)
virtual YTimeField *createTimeField (YWidget *parent, const string &label);
- virtual bool hasTimezoneSelector() IMPL_RET (true)
+ virtual bool hasTimezoneSelector() RET (true)
virtual YTimezoneSelector *createTimezoneSelector (YWidget *parent,
const string &pixmap, const map <string, string> &timezones);
- virtual bool hasBarGraph() IMPL_RET (true)
+ virtual bool hasBarGraph() RET (true)
virtual YBarGraph *createBarGraph (YWidget *parent);
- virtual bool hasMultiProgressMeter() IMPL_RET (true)
+ virtual bool hasMultiProgressMeter() RET (true)
virtual YMultiProgressMeter *createMultiProgressMeter (YWidget *parent,
YUIDimension dim, const vector<float> &maxValues);
- virtual bool hasPartitionSplitter() IMPL_RET (true)
+ virtual bool hasPartitionSplitter() RET (true)
virtual YPartitionSplitter *createPartitionSplitter (YWidget *parent,
int usedSize, int totalFreeSize, int newPartSize, int minNewPartSize,
int minFreeSize, const string &usedLabel, const string &freeLabel,
const string &newPartLabel, const string &freeFieldLabel,
const string &newPartFieldLabel);
- virtual bool hasDownloadProgress() IMPL_RET (true)
+ virtual bool hasDownloadProgress() RET (true)
virtual YDownloadProgress *createDownloadProgress (YWidget *parent,
const string &label, const string & filename, YFileSize_t expectedFileSize);
- virtual bool hasSimplePatchSelector() IMPL_RET (false)
- virtual YWidget *createSimplePatchSelector (YWidget *parent, long modeFlags)
- IMPL_RET (NULL)
- virtual bool hasPatternSelector() IMPL_RET (false)
- virtual YWidget *createPatternSelector (YWidget *parent, long modeFlags)
- IMPL_RET (NULL)
+ virtual bool hasContextMenu() RET (true)
+
+ virtual bool hasSimplePatchSelector() RET (false)
+ virtual YWidget *createSimplePatchSelector (YWidget *parent, long modeFlags) RET (NULL)
+ virtual bool hasPatternSelector() RET (false)
+ virtual YWidget *createPatternSelector (YWidget *parent, long modeFlags) RET (NULL)
};
#include <YApplication.h>
@@ -209,7 +204,7 @@
virtual void busyCursor() { YGUI::ui()->busyCursor(); }
virtual void normalCursor() { YGUI::ui()->normalCursor(); }
- virtual void makeScreenShot (string filename);
+ virtual void makeScreenShot (const std::string &filename);
virtual void beep();
virtual int deviceUnits (YUIDimension dim, float layout_units);
@@ -222,17 +217,21 @@
virtual int defaultWidth(); // internally, use _defaultWidth / Height()
virtual int defaultHeight();
- virtual bool isTextMode() IMPL_RET (false)
- virtual bool leftHandedMouse() IMPL_RET (false)
- virtual bool hasImageSupport() IMPL_RET (true)
- virtual bool hasLocalImageSupport() IMPL_RET (true)
- virtual bool hasAnimationSupport() IMPL_RET (true)
- virtual bool hasIconSupport() IMPL_RET (true)
- virtual bool hasFullUtf8Support() IMPL_RET (true)
+ virtual bool isTextMode() RET (false)
+ virtual bool leftHandedMouse() RET (false)
+ virtual bool hasImageSupport() RET (true)
+ virtual bool hasLocalImageSupport() RET (true)
+ virtual bool hasAnimationSupport() RET (true)
+ virtual bool hasIconSupport() RET (true)
+ virtual bool hasFullUtf8Support() RET (true)
#ifdef USE_WEBKIT
- virtual bool richTextSupportsTable() IMPL_RET (true)
+ virtual bool richTextSupportsTable() RET (true)
#else
- virtual bool richTextSupportsTable() IMPL_RET (false)
+ virtual bool richTextSupportsTable() RET (false)
+#endif
+
+#if YAST2_VERSION > 2018003
+ virtual bool openContextMenu (const YItemCollection &itemCollection);
#endif
private:
@@ -241,5 +240,7 @@
std::string screenShotNameTemplate;
};
+#undef RET
+
#endif /*YGUI_H*/
Modified: trunk/gtk/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=59804&r1=…
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Thu Nov 26 18:14:14 2009
@@ -1,11 +1,16 @@
/********************************************************************
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
+/*
+ Textdomain "yast2-gtk"
+ */
-#include <config.h>
+#define YUILogComponent "gtk"
+#include "config.h"
#include <string.h>
-#include "YGUI.h"
#include "YGUtils.h"
+#include "YGUI.h"
+#include "YGi18n.h"
static inline void skipSpace (const char *instr, int *i)
{ while (g_ascii_isspace (instr[*i])) (*i)++; }
@@ -395,15 +400,15 @@
gtk_adjustment_set_value (vadj, vadj->upper - vadj->page_size);
return FALSE;
}
+
void YGUtils::scrollWidget (GtkAdjustment *vadj, bool top)
{
- // for some widgets, we need to change adjustment before moving down...
- gtk_adjustment_set_value (vadj, vadj->lower);
- if (!top) {
+ if (top)
+ gtk_adjustment_set_value (vadj, vadj->lower);
+ else
// since we usually want to call this together with a text change, we
// must wait till that gets in effect
- g_timeout_add_full (G_PRIORITY_LOW, 25, scroll_down_cb, vadj, NULL);
- }
+ g_idle_add_full (G_PRIORITY_LOW, scroll_down_cb, vadj, NULL);
}
void ygutils_scrollAdj (GtkAdjustment *vadj, gboolean top)
@@ -568,6 +573,9 @@
{
static bool firstTime = true; static std::map <std::string, std::string> stockMap;
if (firstTime) {
+ firstTime = false;
+
+ // match GTK stock labels to yast ones
GSList *list = gtk_stock_list_ids();
for (GSList *i = list; i; i = i->next) {
gchar *id = (gchar *) i->data;
@@ -585,7 +593,20 @@
g_free (id);
}
g_slist_free (list);
- firstTime = false;
+
+ stockMap [_("Apply")] = GTK_STOCK_APPLY;
+ stockMap [_("Accept")] = GTK_STOCK_APPLY;
+ stockMap [_("OK")] = GTK_STOCK_OK;
+ stockMap [_("Cancel")] = GTK_STOCK_CANCEL;
+ stockMap [_("Yes")] = GTK_STOCK_YES;
+ stockMap [_("No")] = GTK_STOCK_NO;
+ stockMap [_("Add")] = GTK_STOCK_ADD;
+ stockMap [_("Edit")] = GTK_STOCK_EDIT;
+ stockMap [_("Delete")] = GTK_STOCK_DELETE;
+ stockMap [_("Up")] = GTK_STOCK_GO_UP;
+ stockMap [_("Down")] = GTK_STOCK_GO_DOWN;
+ stockMap [_("Enable")] = GTK_STOCK_YES;
+ stockMap [_("Disable")] = GTK_STOCK_NO;
}
std::string id = cutUnderline (label);
@@ -605,8 +626,8 @@
if (gtk_style_lookup_icon_set (button->style, icon)) {
// we want to use GtkImage stock mode so it honors sensitive
GtkWidget *image = gtk_image_new_from_stock (icon, GTK_ICON_SIZE_BUTTON);
- gtk_button_set_image (GTK_BUTTON (button), image);
gtk_widget_show (image);
+ gtk_button_set_image (GTK_BUTTON (button), image);
}
}
else {
Modified: trunk/gtk/src/YGWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.cc?rev=59804&r1…
==============================================================================
--- trunk/gtk/src/YGWidget.cc (original)
+++ trunk/gtk/src/YGWidget.cc Thu Nov 26 18:14:14 2009
@@ -2,7 +2,8 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
+#define YUILogComponent "gtk"
+#include "config.h"
#include <stdarg.h>
#include "YGWidget.h"
#include "YGUtils.h"
@@ -67,7 +68,7 @@
{
m_widget = GTK_WIDGET (g_object_new_valist (type, property_name, args));
- if (type == GTK_TYPE_WINDOW)
+ if (type == GTK_TYPE_WINDOW || type == GTK_TYPE_MENU)
m_adj_size = m_widget;
else {
m_adj_size = ygtk_adj_size_new();
@@ -91,7 +92,6 @@
YGWidget::~YGWidget()
{
- IMPL
delete m_signals;
m_signals = 0;
if (YGUI::ui()->eventPendingFor (m_ywidget))
@@ -193,6 +193,10 @@
}
};
+#if YAST2_VERSION > 2018003
+ if (reason == YEvent::ContextMenuActivated && !m_ywidget->notifyContextMenu())
+ ; // cancel
+#endif
if (flags & IGNORE_NOTIFY_EVENT || m_ywidget->notify()) {
YWidgetEvent *event = new YWidgetEvent (m_ywidget, reason);
if (flags & DELAY_EVENT)
@@ -216,10 +220,7 @@
{ if (m_signals) m_signals->unblock(); }
void YGWidget::setBorder (unsigned int border)
-{
- IMPL
- gtk_container_set_border_width (GTK_CONTAINER (m_adj_size), border);
-}
+{ gtk_container_set_border_width (GTK_CONTAINER (m_adj_size), border); }
/* YGLabeledWidget follows */
Modified: trunk/gtk/src/YGWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWizard.cc?rev=59804&r1…
==============================================================================
--- trunk/gtk/src/YGWizard.cc (original)
+++ trunk/gtk/src/YGWizard.cc Thu Nov 26 18:14:14 2009
@@ -2,8 +2,9 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
-#include <YGUI.h>
+#define YUILogComponent "gtk"
+#include "config.h"
+#include "YGUI.h"
#include "YGWidget.h"
#include "YGUtils.h"
#include "ygtkwizard.h"
@@ -84,7 +85,6 @@
: YWizard (NULL, backButtonLabel, abortButtonLabel, nextButtonLabel, wizardMode)
, YGWidget (this, parent, YGTK_TYPE_WIZARD, NULL)
{
- IMPL
setBorder (0);
YGtkWizard *wizard = getWizard();
@@ -118,6 +118,7 @@
m_abort_button = new YGWButton (this, wizard->abort_button, abortButtonLabel);
m_next_button = new YGWButton (this, wizard->next_button, nextButtonLabel);
m_notes_button = new YGWButton (this, wizard->release_notes_button, string());
+ ygtk_wizard_set_default_button (wizard, wizard->next_button);
//** All event are sent through this signal together with an id
g_signal_connect (G_OBJECT (getWidget()), "action-triggered",
@@ -278,7 +279,6 @@
static void action_triggered_cb (YGtkWizard *wizard, gpointer id,
gint id_type, YGWizard *pThis)
{
- IMPL
if ((GType) id_type == G_TYPE_STRING)
YGUI::ui()->sendEvent (new YMenuEvent ((char *) id));
else
Modified: trunk/gtk/src/YGi18n.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGi18n.h?rev=59804&r1=59…
==============================================================================
--- trunk/gtk/src/YGi18n.h (original)
+++ trunk/gtk/src/YGi18n.h Thu Nov 26 18:14:14 2009
@@ -1,43 +1,20 @@
-/*---------------------------------------------------------------------\
-| |
-| __ __ ____ _____ ____ |
-| \ \ / /_ _/ ___|_ _|___ \ |
-| \ V / _` \___ \ | | __) | |
-| | | (_| |___) || | / __/ |
-| |_|\__,_|____/ |_| |_____| |
-| |
-| core system |
-| (C) SuSE GmbH |
-\----------------------------------------------------------------------/
-
- File: YGi18n.h
-
- Author: Jiri Srain <jsrain(a)suse.cz>
-
-/-*/
-
-// -*- c++ -*-
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
#ifndef YGi18n_h
#define YGi18n_h
#include <libintl.h>
-
#define TEXTDOMAIN "yast2-gtk"
-// tag for translation but don't translate; no N_ in y2makepot ...
-#define __(a) (a)
-
-static inline const char * _( const char * msgid )
-{
- return ( !msgid || !*msgid ) ? "" : dgettext( TEXTDOMAIN, msgid );
-}
+static inline const char *_(const char *msgid)
+{ return dgettext (TEXTDOMAIN, msgid); }
#ifndef YGI18N_C
-static inline const char * _( const char * msgid1, const char * msgid2, unsigned long int n )
-{
- return dngettext( TEXTDOMAIN, msgid1, msgid2, n );
-}
+static inline const char * _(const char * msgid1, const char *msgid2, unsigned long int n)
+{ return dngettext(TEXTDOMAIN, msgid1, msgid2, n); }
#endif
-#endif // YGi18n_h
+#endif /*YGi18n_h*/
+
Modified: trunk/gtk/src/test.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/test.cc?rev=59804&r1=598…
==============================================================================
--- trunk/gtk/src/test.cc (original)
+++ trunk/gtk/src/test.cc Thu Nov 26 18:14:14 2009
@@ -2,7 +2,8 @@
* YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
********************************************************************/
-#include <config.h>
+#define YUILogComponent "gtk"
+#include "config.h"
#include <stdio.h>
#include <string.h>
#include <YUI.h>
Modified: trunk/gtk/src/ygtkbargraph.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkbargraph.c?rev=59804…
==============================================================================
--- trunk/gtk/src/ygtkbargraph.c (original)
+++ trunk/gtk/src/ygtkbargraph.c Thu Nov 26 18:14:14 2009
@@ -6,15 +6,18 @@
// check the header file for information about this widget
#include <config.h>
+#include "ygtkratiobox.h"
#include "ygtkbargraph.h"
#include <gtk/gtk.h>
-G_DEFINE_TYPE (YGtkBarGraph, ygtk_bar_graph, YGTK_TYPE_RATIO_HBOX)
+G_DEFINE_TYPE (YGtkBarGraph, ygtk_bar_graph, GTK_TYPE_FRAME)
static void ygtk_bar_graph_init (YGtkBarGraph *bar)
{
-// ygtk_ratio_box_set_homogeneous (YGTK_RATIO_BOX (bar), TRUE);
- gtk_container_set_border_width (GTK_CONTAINER (bar), 12);
+ GtkWidget *box = ygtk_ratio_hbox_new (0);
+ gtk_widget_show (box);
+ gtk_container_add (GTK_CONTAINER (bar), box);
+ ygtk_bar_graph_set_style (bar, TRUE);
}
static void ygtk_bar_graph_size_request (GtkWidget *widget, GtkRequisition *requisition)
@@ -30,7 +33,7 @@
void ygtk_bar_graph_create_entries (YGtkBarGraph *bar, guint entries)
{
- YGtkRatioBox *box = YGTK_RATIO_BOX (bar);
+ YGtkRatioBox *box = YGTK_RATIO_BOX (GTK_BIN (bar)->child);
// Remove the ones in excess
guint i;
@@ -56,8 +59,8 @@
static GtkWidget *ygtk_bar_graph_get_label (YGtkBarGraph *bar, int index, GtkWidget **b)
{
- GtkWidget *box = ((YGtkRatioBoxChild *) g_list_nth_data (
- YGTK_RATIO_BOX (bar)->children, index))->widget;
+ YGtkRatioBox *hbox = YGTK_RATIO_BOX (GTK_BIN (bar)->child);
+ GtkWidget *box = ((YGtkRatioBoxChild *) g_list_nth_data (hbox->children, index))->widget;
if (b) *b = box;
return gtk_bin_get_child (GTK_BIN (box));
}
@@ -92,7 +95,8 @@
// Set proportion
gtk_widget_set_size_request (box, 0, -1);
- ygtk_ratio_box_set_child_packing (YGTK_RATIO_BOX (bar), box, MAX (value, 1));
+ YGtkRatioBox *hbox = YGTK_RATIO_BOX (GTK_BIN (bar)->child);
+ ygtk_ratio_box_set_child_packing (hbox, box, MAX (value, 1));
// Set background color
// The Tango palette
@@ -135,6 +139,8 @@
void ygtk_bar_graph_set_style (YGtkBarGraph *bar, gboolean flat)
{
bar->flat = flat;
+ GtkShadowType shadow = flat ? GTK_SHADOW_OUT : GTK_SHADOW_NONE;
+ gtk_frame_set_shadow_type (GTK_FRAME (bar), shadow);
}
void ygtk_bar_graph_customize_bg (YGtkBarGraph *bar, int index, GdkColor *color)
Modified: trunk/gtk/src/ygtkbargraph.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkbargraph.h?rev=59804…
==============================================================================
--- trunk/gtk/src/ygtkbargraph.h (original)
+++ trunk/gtk/src/ygtkbargraph.h Thu Nov 26 18:14:14 2009
@@ -9,7 +9,7 @@
#ifndef YGTK_BAR_GRAPH_H
#define YGTK_BAR_GRAPH_H
-#include "ygtkratiobox.h"
+#include <gtk/gtkframe.h>
G_BEGIN_DECLS
#define YGTK_TYPE_BAR_GRAPH (ygtk_bar_graph_get_type ())
@@ -29,14 +29,14 @@
struct _YGtkBarGraph
{
- YGtkRatioHBox parent;
+ GtkFrame parent;
// members:
guint flat : 2;
};
struct _YGtkBarGraphClass
{
- YGtkRatioHBoxClass parent_class;
+ GtkFrameClass parent_class;
};
GtkWidget *ygtk_bar_graph_new (void);
Modified: trunk/gtk/src/ygtkcellrenderertextpixbuf.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkcellrenderertextpixb…
==============================================================================
--- trunk/gtk/src/ygtkcellrenderertextpixbuf.c (original)
+++ trunk/gtk/src/ygtkcellrenderertextpixbuf.c Thu Nov 26 18:14:14 2009
@@ -8,11 +8,15 @@
#include <config.h>
#include "ygtkcellrenderertextpixbuf.h"
+extern GdkPixbuf *ygutils_setOpacity (const GdkPixbuf *src, int opacity, gboolean alpha);
+
#define PIXBUF_TEXT_SPACING 4
enum {
PROP_0,
- PROP_PIXBUF
+ PROP_PIXBUF,
+ PROP_STOCK_ID,
+ PROP_STOCK_SIZE,
};
G_DEFINE_TYPE (YGtkCellRendererTextPixbuf, ygtk_cell_renderer_text_pixbuf, GTK_TYPE_CELL_RENDERER_TEXT)
@@ -21,19 +25,28 @@
{
GtkCellRenderer *cell = GTK_CELL_RENDERER (tpcell);
cell->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
- cell->xalign = 0.0;
+ cell->xpad = cell->ypad = 0;
+ cell->xalign = 0;
cell->yalign = 0.5;
- cell->xpad = 0;
- cell->ypad = 0;
+ tpcell->stock_size = GTK_ICON_SIZE_MENU;
+}
+
+static void unset_image_properties (YGtkCellRendererTextPixbuf *cell)
+{
+ if (cell->stock_id) {
+ g_free (cell->stock_id);
+ cell->stock_id = NULL;
+ }
+ if (cell->pixbuf) {
+ g_object_unref (cell->pixbuf);
+ cell->pixbuf = NULL;
+ }
}
static void ygtk_cell_renderer_text_pixbuf_finalize (GObject *object)
{
YGtkCellRendererTextPixbuf *tpcell = YGTK_CELL_RENDERER_TEXT_PIXBUF (object);
- if (tpcell->pixbuf) {
- g_object_unref (G_OBJECT (tpcell->pixbuf));
- tpcell->pixbuf = NULL;
- }
+ unset_image_properties (tpcell);
G_OBJECT_CLASS (ygtk_cell_renderer_text_pixbuf_parent_class)->finalize (object);
}
@@ -46,6 +59,12 @@
case PROP_PIXBUF:
g_value_set_object (value, G_OBJECT (tpcell->pixbuf));
break;
+ case PROP_STOCK_ID:
+ g_value_set_string (value, tpcell->stock_id);
+ break;
+ case PROP_STOCK_SIZE:
+ g_value_set_uint (value, tpcell->stock_size);
+ break;
}
}
else
@@ -60,10 +79,16 @@
YGtkCellRendererTextPixbuf *tpcell = YGTK_CELL_RENDERER_TEXT_PIXBUF (object);
switch (param_id) {
case PROP_PIXBUF:
- if (tpcell->pixbuf)
- g_object_unref (G_OBJECT (tpcell->pixbuf));
+ unset_image_properties (tpcell);
tpcell->pixbuf = (GdkPixbuf *) g_value_dup_object (value);
break;
+ case PROP_STOCK_ID:
+ unset_image_properties (tpcell);
+ tpcell->stock_id = g_value_dup_string (value);
+ break;
+ case PROP_STOCK_SIZE:
+ tpcell->stock_size = g_value_get_uint (value);
+ break;
}
}
else
@@ -79,42 +104,82 @@
return NULL;
}
-#define XPAD 1
-#define YPAD 0
+static void ensure_pixbuf (YGtkCellRendererTextPixbuf *cell, GtkWidget *widget)
+{
+ if (cell->stock_id && !cell->pixbuf)
+ cell->pixbuf = gtk_widget_render_icon (widget, cell->stock_id, cell->stock_size, NULL);
+}
-static void ygtk_cell_renderer_text_pixbuf_get_size (GtkCellRenderer *cell,
- GtkWidget *widget, GdkRectangle *cell_area, gint *xoffset, gint *yoffset,
- gint *width, gint *height)
+static void ygtk_cell_renderer_text_pixbuf_get_size_full (GtkCellRenderer *cell,
+ GtkWidget *widget, GdkRectangle *cell_area, gint *_xoffset, gint *_yoffset,
+ gint *_width, gint *_height, gint *_pixbuf_xoffset, gint *_pixbuf_yoffset,
+ gint *_pixbuf_width, gint *_pixbuf_height, gint *_text_xoffset, gint *_text_yoffset)
{
- GtkCellRendererText *tcell = GTK_CELL_RENDERER_TEXT (cell);
YGtkCellRendererTextPixbuf *tpcell = YGTK_CELL_RENDERER_TEXT_PIXBUF (cell);
+ ensure_pixbuf (tpcell, widget);
- // will be calculated at expose, as both pixbuf and text have their offsets...
- if (xoffset) *xoffset = 0;
- if (yoffset) *yoffset = 0;
- if (!width || !height)
- return;
- *width = 0;
- *height = 0;
-
+ int pixbuf_width = 0, pixbuf_height = 0;
if (tpcell->pixbuf) {
- *width += gdk_pixbuf_get_width (tpcell->pixbuf);
- *height = MAX (*height, gdk_pixbuf_get_height (tpcell->pixbuf));
+ pixbuf_width = gdk_pixbuf_get_width (tpcell->pixbuf);
+ pixbuf_height = gdk_pixbuf_get_height (tpcell->pixbuf);
}
- if (tcell->text) {
- if (tpcell->pixbuf)
- *width += PIXBUF_TEXT_SPACING;
-
- PangoLayout *layout = create_layout (tpcell, widget);
- int lw, lh;
- pango_layout_get_pixel_size (layout, &lw, &lh);
- *width += lw;
- *height = MAX (*height, lh);
- g_object_unref (G_OBJECT (layout));
+ PangoLayout *layout = create_layout (tpcell, widget);
+ int text_width = 0, text_height = 0;
+ if (layout) {
+ PangoRectangle rect;
+ pango_layout_get_pixel_extents (layout, NULL, &rect);
+ text_width = rect.x + rect.width;
+ text_height = rect.y + rect.height;
}
- *width += (cell->xpad+XPAD)*2;
- *height += (cell->ypad+YPAD)*2;
+
+ int width, height;
+ width = pixbuf_width + text_width;
+ if (pixbuf_width && text_width)
+ width += PIXBUF_TEXT_SPACING;
+ height = MAX (pixbuf_height, text_height);
+
+ if (cell_area) {
+ gboolean reverse = gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL;
+ gfloat xalign = cell->xalign, yalign = cell->yalign;
+ if (reverse)
+ xalign = 1.0 - xalign;
+
+ int cell_width = cell_area->width - cell->xpad*2,
+ cell_height = cell_area->height - cell->ypad*2;
+ int xoffset = (xalign * (cell_width - width)) + cell->xpad;
+ int yoffset = (yalign * (cell_height - height)) + cell->ypad;
+ if (_xoffset) *_xoffset = xoffset;
+ if (_yoffset) *_yoffset = yoffset;
+
+ int text_x = xoffset, text_y;
+ if (pixbuf_width && !reverse)
+ text_x += (pixbuf_width + PIXBUF_TEXT_SPACING);
+ text_y = (yalign * (cell_height - text_height)) + cell->ypad;
+
+ int pixbuf_x = xoffset, pixbuf_y;
+ if (text_width && reverse)
+ pixbuf_x += (text_width + PIXBUF_TEXT_SPACING);
+ pixbuf_y = (yalign * (cell_height - pixbuf_height)) + cell->ypad;
+
+ if (_pixbuf_xoffset) *_pixbuf_xoffset = pixbuf_x;
+ if (_pixbuf_yoffset) *_pixbuf_yoffset = pixbuf_y;
+ if (_pixbuf_width) *_pixbuf_width = pixbuf_width;
+ if (_pixbuf_height) *_pixbuf_height = pixbuf_height;
+ if (_text_xoffset) *_text_xoffset = text_x;
+ if (_text_yoffset) *_text_yoffset = text_y;
+ }
+
+ if (_width) *_width = width + (cell->xpad * 2);
+ if (_height) *_height = height + (cell->ypad * 2);
+}
+
+static void ygtk_cell_renderer_text_pixbuf_get_size (GtkCellRenderer *cell,
+ GtkWidget *widget, GdkRectangle *cell_area, gint *xoffset, gint *yoffset,
+ gint *width, gint *height)
+{
+ ygtk_cell_renderer_text_pixbuf_get_size_full (cell, widget, cell_area,
+ xoffset, yoffset, width, height, NULL, NULL, NULL, NULL, NULL, NULL);
}
static void ygtk_cell_renderer_text_pixbuf_render (GtkCellRenderer *cell,
@@ -142,55 +207,28 @@
state = GTK_STATE_NORMAL;
}
- // positioning
-
- gboolean reverse = gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL;
- gfloat xalign = cell->xalign, yalign = cell->yalign;
- if (reverse)
- xalign = 1.0 - xalign;
-
- GdkPixbuf *pixbuf = tpcell->pixbuf;
- int pixbuf_width = 0, pixbuf_height = 0;
- if (pixbuf) {
- pixbuf_width = gdk_pixbuf_get_width (pixbuf);
- pixbuf_height = gdk_pixbuf_get_height (pixbuf);
- }
-
- PangoLayout *layout = create_layout (tpcell, widget);
- int text_width = 0, text_height = 0;
- if (layout) {
- PangoRectangle rect;
- pango_layout_get_pixel_extents (layout, NULL, &rect);
- text_width = rect.width;
- text_height = rect.height;
- }
-
- int spacing = (text_width && pixbuf_width) ? PIXBUF_TEXT_SPACING : 0;
- int offset_x = xalign * (cell_area->width - (text_width + pixbuf_width + spacing));
-
- int text_x = offset_x, text_y;
- if (pixbuf_width && !reverse)
- text_x += (pixbuf_width + spacing);
- text_y = yalign * (cell_area->height - text_height);
-
- int pixbuf_x = offset_x, pixbuf_y;
- if (text_width && reverse)
- pixbuf_x += (text_width + spacing);
- pixbuf_y = yalign * (cell_area->height - pixbuf_height);
+ int text_xoffset, text_yoffset, pixbuf_xoffset, pixbuf_yoffset, pixbuf_width,
+ pixbuf_height;
+ ygtk_cell_renderer_text_pixbuf_get_size_full (cell, widget, cell_area,
+ NULL, NULL, NULL, NULL, &pixbuf_xoffset, &pixbuf_yoffset, &pixbuf_width,
+ &pixbuf_height, &text_xoffset, &text_yoffset);
// paint
- int x = cell_area->x + cell->xpad+XPAD, y = cell_area->y + cell->ypad+YPAD;
- if (pixbuf) {
+ ensure_pixbuf (tpcell, widget);
+ if (tpcell->pixbuf) {
+ int x = cell_area->x + pixbuf_xoffset, y = cell_area->y + pixbuf_yoffset;
cairo_t *cr = gdk_cairo_create (window);
- gdk_cairo_set_source_pixbuf (cr, pixbuf, pixbuf_x+x, pixbuf_y+y);
- cairo_rectangle (cr, pixbuf_x+x, pixbuf_y+y, pixbuf_width, pixbuf_height);
+ gdk_cairo_set_source_pixbuf (cr, tpcell->pixbuf, x, y);
+ cairo_rectangle (cr, x, y, pixbuf_width, pixbuf_height);
cairo_fill (cr);
cairo_destroy (cr);
}
+ PangoLayout *layout = create_layout (tpcell, widget);
if (layout) {
+ int x = cell_area->x + text_xoffset, y = cell_area->y + text_yoffset;
GtkStyle *style = gtk_widget_get_style (widget);
gtk_paint_layout (style, window, state, TRUE, expose_area, widget,
- "cellrenderertext", text_x+x, text_y+y, layout);
+ "cellrenderertext", x, y, layout);
g_object_unref (G_OBJECT (layout));
}
}
@@ -211,8 +249,14 @@
cell_class->get_size = ygtk_cell_renderer_text_pixbuf_get_size;
cell_class->render = ygtk_cell_renderer_text_pixbuf_render;
+ GParamFlags readwrite_flag =
+ G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB;
g_object_class_install_property (object_class, PROP_PIXBUF,
- g_param_spec_object ("pixbuf", "Image", "Side image", GDK_TYPE_PIXBUF,
- G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
+ g_param_spec_object ("pixbuf", "Image", "Side image", GDK_TYPE_PIXBUF, readwrite_flag));
+ g_object_class_install_property (object_class, PROP_STOCK_ID,
+ g_param_spec_string ("stock-id", "Stock ID", "Stock icon to render", NULL, readwrite_flag));
+ g_object_class_install_property (object_class, PROP_STOCK_SIZE,
+ g_param_spec_uint ("stock-size", "Size", "GtkIconSize of the rendered icon",
+ 0, G_MAXUINT, GTK_ICON_SIZE_MENU, readwrite_flag));
}
Modified: trunk/gtk/src/ygtkcellrenderertextpixbuf.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkcellrenderertextpixb…
==============================================================================
--- trunk/gtk/src/ygtkcellrenderertextpixbuf.h (original)
+++ trunk/gtk/src/ygtkcellrenderertextpixbuf.h Thu Nov 26 18:14:14 2009
@@ -33,6 +33,8 @@
// private:
GdkPixbuf *pixbuf;
+ gchar *stock_id;
+ GtkIconSize stock_size;
} YGtkCellRendererTextPixbuf;
typedef struct _YGtkCellRendererTextPixbufClass
Modified: trunk/gtk/src/ygtkfindentry.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfindentry.c?rev=5980…
==============================================================================
--- trunk/gtk/src/ygtkfindentry.c (original)
+++ trunk/gtk/src/ygtkfindentry.c Thu Nov 26 18:14:14 2009
@@ -301,7 +301,7 @@
if (entry->find_icon) {
left_border = gdk_pixbuf_get_width (entry->find_icon) + 2;
if (entry->context_menu)
- left_border += ARROW_SIZE - 1;
+ left_border += ARROW_SIZE;
}
if (entry->clear_icon)
right_border = gdk_pixbuf_get_width (entry->clear_icon) + 2;
@@ -346,6 +346,19 @@
gdk_window_hide (eentry->right_window); // show when text is inserted
}
+static void ygtk_find_entry_unrealize (GtkWidget *widget)
+{
+ GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->unrealize (widget);
+
+ YGtkFindEntry *fentry = YGTK_FIND_ENTRY (widget);
+ generate_icon (NULL, NULL, &fentry->find_icon, &fentry->find_hover_icon);
+ generate_icon (NULL, NULL, &fentry->clear_icon, &fentry->clear_hover_icon);
+
+ YGtkExtEntry *eentry = YGTK_EXT_ENTRY (widget);
+ ygtk_ext_entry_set_border_window_size (eentry, YGTK_EXT_ENTRY_LEFT_WIN, 0);
+ ygtk_ext_entry_set_border_window_size (eentry, YGTK_EXT_ENTRY_RIGHT_WIN, 0);
+}
+
static void ygtk_find_entry_map (GtkWidget *widget)
{
GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->map (widget);
@@ -365,17 +378,22 @@
GdkWindow *hover_window = gdk_display_get_window_at_pointer (
gtk_widget_get_display (widget), NULL, NULL);
- if (event->window == eentry->left_window ||
- event->window == eentry->right_window) {
+ if (event->window == eentry->left_window || event->window == eentry->right_window) {
gboolean hover = hover_window == event->window;
+ int win_width, win_height;
+ gdk_drawable_get_size (event->window, &win_width, &win_height);
+
+/* if (fentry->context_menu && event->window == eentry->left_window)
+ gtk_paint_box (widget->style, event->window, GTK_STATE_NORMAL,
+ GTK_SHADOW_OUT, &event->area, widget, "combobox",
+ 0, 0, win_width, win_height);*/
+
GdkPixbuf *pixbuf;
if (event->window == eentry->left_window)
pixbuf = hover ? fentry->find_hover_icon : fentry->find_icon;
else
pixbuf = hover ? fentry->clear_hover_icon : fentry->clear_icon;
-
- int pix_height = gdk_pixbuf_get_height (pixbuf), win_width, win_height, y;
- gdk_drawable_get_size (event->window, &win_width, &win_height);
+ int pix_height = gdk_pixbuf_get_height (pixbuf), y;
y = (win_height - pix_height) / 2;
gdk_draw_pixbuf (event->window, widget->style->fg_gc[0], pixbuf,
@@ -383,10 +401,8 @@
if (fentry->context_menu && event->window == eentry->left_window)
gtk_paint_arrow (widget->style, event->window, GTK_STATE_NORMAL,
- GTK_SHADOW_NONE, &event->area, widget, NULL,
- GTK_ARROW_DOWN, FALSE,
- win_width - ARROW_SIZE - 1, win_height - ARROW_SIZE,
- ARROW_SIZE, ARROW_SIZE);
+ GTK_SHADOW_NONE, &event->area, widget, NULL, GTK_ARROW_DOWN, FALSE,
+ win_width - ARROW_SIZE-1, (win_height - ARROW_SIZE)/2, ARROW_SIZE, ARROW_SIZE);
}
else
GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->expose_event (widget, event);
@@ -630,6 +646,7 @@
{
GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->realize = ygtk_find_entry_realize;
+ gtkwidget_class->unrealize = ygtk_find_entry_unrealize;
gtkwidget_class->map = ygtk_find_entry_map;
gtkwidget_class->expose_event = ygtk_find_entry_expose;
gtkwidget_class->enter_notify_event = ygtk_find_entry_enter_leave_notify_event;
Modified: trunk/gtk/src/ygtkfindentry.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfindentry.h?rev=5980…
==============================================================================
--- trunk/gtk/src/ygtkfindentry.h (original)
+++ trunk/gtk/src/ygtkfindentry.h Thu Nov 26 18:14:14 2009
@@ -14,6 +14,8 @@
YGtkFindEntry is a convinience widget that has a find icon, with an
optional menu, at the left, and an erase icon at the right. It can
interact with an option image menu, and does auto-completion.
+
+ TODO: deprecate in favor of using GtkEntry 2.16 new APIs.
*/
#ifndef YGTK_FIND_ENTRY_H
Modified: trunk/gtk/src/ygtkhtmlwrap.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkhtmlwrap.c?rev=59804…
==============================================================================
--- trunk/gtk/src/ygtkhtmlwrap.c (original)
+++ trunk/gtk/src/ygtkhtmlwrap.c Thu Nov 26 18:14:14 2009
@@ -182,7 +182,7 @@
}
static WebKitNavigationResponse ygtk_webkit_navigation_requested_cb (
- WebKitWebView *view, WebKitWebFrame *frame, WebKitNetworkRequest *request, void (*callback) (GtkWidget *widget, const gchar *uri, gpointer d))
+ WebKitWebView *view, WebKitWebFrame *frame, WebKitNetworkRequest *request, LinkClickedCb callback)
{
const gchar *uri = webkit_network_request_get_uri (request);
// look for set_text to see why we need to cut the uri in some cases
@@ -194,7 +194,7 @@
return WEBKIT_NAVIGATION_RESPONSE_IGNORE;
}
-void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, GCallback callback, gpointer data)
+void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, LinkClickedCb callback, gpointer data)
{
g_object_set_data (G_OBJECT (widget), "pointer", data);
g_signal_connect (G_OBJECT (widget), "navigation-requested",
@@ -279,9 +279,9 @@
return gtk_html_engine_search_next (GTK_HTML (widget));
}
-void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, GCallback callback, gpointer data)
+void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, LinkClickedCb callback, gpointer data)
{
- g_signal_connect (G_OBJECT (widget), "link-clicked", callback, data);
+ g_signal_connect (G_OBJECT (widget), "link-clicked", G_CALLBACK (callback), data);
}
void ygtk_html_wrap_set_background (GtkWidget *widget, GdkPixbuf *pixbuf, const gchar *filename)
@@ -304,7 +304,11 @@
void ygtk_html_wrap_set_text (GtkWidget *widget, const gchar* text, gboolean plain_mode)
{
- ygtk_rich_text_set_text (YGTK_RICH_TEXT (widget), text, plain_mode);
+ YGtkRichText *rtext = YGTK_RICH_TEXT (widget);
+ if (plain_mode)
+ ygtk_rich_text_set_plain_text (rtext, text);
+ else
+ ygtk_rich_text_set_text (rtext, text);
}
void ygtk_html_wrap_scroll (GtkWidget *widget, gboolean top)
@@ -324,9 +328,9 @@
return ygtk_rich_text_forward_mark (YGTK_RICH_TEXT (widget), text);
}
-void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, GCallback callback, gpointer data)
+void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, LinkClickedCb callback, gpointer data)
{
- g_signal_connect (G_OBJECT (widget), "link-clicked", callback, data);
+ g_signal_connect (G_OBJECT (widget), "link-clicked", G_CALLBACK (callback), data);
}
void ygtk_html_wrap_set_background (GtkWidget *widget, GdkPixbuf *pixbuf, const gchar *filename)
Modified: trunk/gtk/src/ygtkhtmlwrap.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkhtmlwrap.h?rev=59804…
==============================================================================
--- trunk/gtk/src/ygtkhtmlwrap.h (original)
+++ trunk/gtk/src/ygtkhtmlwrap.h Thu Nov 26 18:14:14 2009
@@ -22,8 +22,8 @@
void ygtk_html_wrap_set_text (GtkWidget *widget, const gchar* text, gboolean plain_mode);
void ygtk_html_wrap_scroll (GtkWidget *widget, gboolean top /* or bottom */);
-// callback of type: void (GtkWidget *htmlwrap, const gchar *url, gpointer data)
-void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, GCallback callback, gpointer data);
+typedef void (*LinkClickedCb) (GtkWidget *htmlwrap, const gchar *url, gpointer data);
+void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, LinkClickedCb callback, gpointer data);
// not supported on plain text
gboolean ygtk_html_wrap_search (GtkWidget *widget, const gchar *text);
Modified: trunk/gtk/src/ygtkratiobox.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.c?rev=59804…
==============================================================================
--- trunk/gtk/src/ygtkratiobox.c (original)
+++ trunk/gtk/src/ygtkratiobox.c Thu Nov 26 18:14:14 2009
@@ -121,6 +121,10 @@
requisition->width += spacing;
else
requisition->height += spacing;
+
+ int border = GTK_CONTAINER (box)->border_width;
+ requisition->width += border*2;
+ requisition->height += border*2;
}
static void ygtk_ratio_box_size_allocate (GtkWidget *widget,
@@ -144,11 +148,15 @@
gint spacing = children_nb ? box->spacing*(children_nb-1) : 0;
+ int border = GTK_CONTAINER (box)->border_width;
+ int x = allocation->x + border, y = allocation->y + border,
+ width = allocation->width - border*2, height = allocation->height - border*2;
+
gint length;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
- length = allocation->width - spacing;
+ length = width - spacing;
else
- length = allocation->height - spacing;
+ length = height - spacing;
gint child_pos = 0;
for (i = box->children; i; i = i->next) {
@@ -160,18 +168,20 @@
gtk_widget_get_child_requisition (child->widget, &child_req);
gint child_length = (child->ratio * length) / ratios_sum;
+ if (!i->next) // last takes rest (any residual length)
+ child_length = length - child_pos;
GtkAllocation child_alloc;
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
- child_alloc.x = allocation->x + child_pos;
- child_alloc.y = allocation->y;
+ child_alloc.x = x + child_pos;
+ child_alloc.y = y;
child_alloc.width = child_length;
- child_alloc.height = allocation->height;
+ child_alloc.height = height;
}
else { // GTK_ORIENTATION_VERTICAL
- child_alloc.x = allocation->x;
- child_alloc.y = allocation->y + child_pos;
- child_alloc.width = allocation->width;
+ child_alloc.x = x;
+ child_alloc.y = y + child_pos;
+ child_alloc.width = width;
child_alloc.height = child_length;
}
Modified: trunk/gtk/src/ygtkrichtext.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkrichtext.c?rev=59804…
==============================================================================
--- trunk/gtk/src/ygtkrichtext.c (original)
+++ trunk/gtk/src/ygtkrichtext.c Thu Nov 26 18:14:14 2009
@@ -24,13 +24,10 @@
// utilities
// Looks at all tags covering the position of iter in the text view,
// and returns the link the text points to, in case that text is a link.
-static const char *get_link (GtkTextView *text_view, gint x, gint y)
+static const char *get_link_at_iter (GtkTextView *text_view, GtkTextIter *iter)
{
- GtkTextIter iter;
- gtk_text_view_get_iter_at_location (text_view, &iter, x, y);
-
char *link = NULL;
- GSList *tags = gtk_text_iter_get_tags (&iter), *tagp;
+ GSList *tags = gtk_text_iter_get_tags (iter), *tagp;
for (tagp = tags; tagp != NULL; tagp = tagp->next) {
GtkTextTag *tag = (GtkTextTag*) tagp->data;
link = (char*) g_object_get_data (G_OBJECT (tag), "link");
@@ -42,23 +39,27 @@
g_slist_free (tags);
return link;
}
+static const char *get_link (GtkTextView *text_view, gint win_x, gint win_y)
+{
+ gint buffer_x, buffer_y;
+ gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
+ GTK_TEXT_WINDOW_WIDGET, win_x, win_y, &buffer_x, &buffer_y);
+ GtkTextIter iter;
+ gtk_text_view_get_iter_at_location (text_view, &iter, buffer_x, buffer_y);
+ return get_link_at_iter (text_view, &iter);
+}
// callbacks
// Links can also be activated by clicking.
static gboolean event_after (GtkWidget *text_view, GdkEvent *ev)
{
- GtkTextIter start, end;
- GtkTextBuffer *buffer;
- GdkEventButton *event;
- gint x, y;
-
if (ev->type != GDK_BUTTON_RELEASE)
return FALSE;
-
- event = (GdkEventButton *)ev;
+ GtkTextIter start, end;
+ GtkTextBuffer *buffer;
+ GdkEventButton *event = (GdkEventButton *) ev;
if (event->button != 1)
return FALSE;
-
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
// We shouldn't follow a link if the user is selecting something.
@@ -66,10 +67,7 @@
if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end))
return FALSE;
- gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
- GTK_TEXT_WINDOW_WIDGET, (gint) event->x, (gint) event->y, &x, &y);
-
- const char *link = get_link (GTK_TEXT_VIEW (text_view), x, y);
+ const char *link = get_link (GTK_TEXT_VIEW (text_view), event->x, event->y);
if (link) // report link
g_signal_emit (YGTK_RICH_TEXT (text_view), link_clicked_signal, 0, link);
return FALSE;
@@ -180,12 +178,9 @@
wy >= widget->allocation.height)
return;
}
- gint bx, by;
- gtk_text_view_window_to_buffer_coords (view, GTK_TEXT_WINDOW_WIDGET,
- wx, wy, &bx, &by);
static gboolean hovering_over_link = FALSE;
- gboolean hovering = get_link (view, bx, by) != NULL;
+ gboolean hovering = get_link (view, wx, wy) != NULL;
if (hovering != hovering_over_link) {
hovering_over_link = hovering;
@@ -382,8 +377,8 @@
// for tags like <br/>, GMarkup will pass them through the end
// tag callback too, so we'll deal with them there
- else if (!g_ascii_strcasecmp (element_name, "br"))
- ;
+ else if (!g_ascii_strcasecmp (element_name, "br")) ;
+ else if (!g_ascii_strcasecmp (element_name, "hr")) ;
else
{
@@ -553,18 +548,16 @@
} while (!gtk_text_iter_is_end (&iter));
}
-void ygtk_rich_text_set_text (YGtkRichText* rtext, const gchar* text, gboolean plain_mode)
+void ygtk_rich_text_set_plain_text (YGtkRichText* rtext, const gchar* text)
{
- GtkTextBuffer *buffer;
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rtext));
-
- if (plain_mode) {
- gtk_text_buffer_set_text (buffer, text, -1);
- return;
- }
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rtext));
+ gtk_text_buffer_set_text (buffer, text, -1);
+}
- // remove any possible existing text
- gtk_text_buffer_set_text (buffer, "", 0);
+void ygtk_rich_text_set_text (YGtkRichText* rtext, const gchar* text)
+{
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rtext));
+ gtk_text_buffer_set_text (buffer, "", 0); // remove any existing text
GRTParseState state;
GRTParseState_init (&state, buffer);
@@ -691,7 +684,7 @@
g_object_ref (G_OBJECT (pixbuf));
}
-void ygtk_rich_text_class_init (YGtkRichTextClass *klass)
+static void ygtk_rich_text_class_init (YGtkRichTextClass *klass)
{
GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->motion_notify_event = ygtk_rich_text_motion_notify_event;
Modified: trunk/gtk/src/ygtkrichtext.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkrichtext.h?rev=59804…
==============================================================================
--- trunk/gtk/src/ygtkrichtext.h (original)
+++ trunk/gtk/src/ygtkrichtext.h Thu Nov 26 18:14:14 2009
@@ -46,7 +46,8 @@
/* Sets some text to YGtkRichText, may be HTML or plain text, as indicated by
rich_text. */
-void ygtk_rich_text_set_text (YGtkRichText* rtext, const gchar* text, gboolean plain_mode);
+void ygtk_rich_text_set_text (YGtkRichText* rtext, const gchar* text);
+void ygtk_rich_text_set_plain_text (YGtkRichText* rtext, const gchar* text);
// To be used together with an entry box to search for text
gboolean ygtk_rich_text_mark_text (YGtkRichText *rtext, const gchar *text);
Modified: trunk/gtk/src/ygtkscrolledwindow.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkscrolledwindow.h?rev…
==============================================================================
--- trunk/gtk/src/ygtkscrolledwindow.h (original)
+++ trunk/gtk/src/ygtkscrolledwindow.h Thu Nov 26 18:14:14 2009
@@ -49,45 +49,3 @@
G_END_DECLS
#endif /*YGTK_SCROLLED_WINDOW_H*/
-/* YGtkTreeView hacks support for a right-click signal.
-*/
-
-#ifndef YGTK_TREE_VIEW_H
-#define YGTK_TREE_VIEW_H
-
-#include <gtk/gtktreeview.h>
-G_BEGIN_DECLS
-
-#define YGTK_TYPE_TREE_VIEW (ygtk_tree_view_get_type ())
-#define YGTK_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- YGTK_TYPE_TREE_VIEW, YGtkScrolledWindow))
-#define YGTK_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
- YGTK_TYPE_TREE_VIEW, YGtkScrolledWindowClass))
-#define YGTK_IS_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- YGTK_TYPE_TREE_VIEW))
-#define YGTK_IS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- YGTK_TYPE_TREE_VIEW))
-#define YGTK_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- YGTK_TYPE_TREE_VIEW, YGtkScrolledWindowClass))
-
-typedef struct _YGtkTreeView
-{
- GtkTreeView parent;
-} YGtkTreeView;
-
-typedef struct _YGtkTreeViewClass
-{
- GtkTreeViewClass parent_class;
-
- // signals:
- void (*right_click) (YGtkTreeView *view, gboolean outreach);
-} YGtkTreeViewClass;
-
-GtkWidget* ygtk_tree_view_new (void);
-GType ygtk_tree_view_get_type (void) G_GNUC_CONST;
-
-void ygtk_tree_view_popup_menu (YGtkTreeView *view, GtkWidget *menu);
-
-G_END_DECLS
-#endif /*YGTK_TREE_VIEW_H*/
-
Modified: trunk/gtk/src/ygtksteps.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtksteps.c?rev=59804&r1…
==============================================================================
--- trunk/gtk/src/ygtksteps.c (original)
+++ trunk/gtk/src/ygtksteps.c Thu Nov 26 18:14:14 2009
@@ -26,15 +26,16 @@
gtk_box_set_spacing (GTK_BOX (steps), 8);
gtk_container_set_border_width (GTK_CONTAINER (steps), 4);
+ const gchar *check = "\u2714", *current = "\u25b6", *todo = "\u26ab";
+ if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
+ current = "\u25c0";
PangoContext *context = gtk_widget_get_pango_context (GTK_WIDGET (steps));
steps->check_mark_layout = pango_layout_new (context);
steps->current_mark_layout = pango_layout_new (context);
-
- const gchar *check = "\u2714", *current = "<b>\u2192</b>";
- if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
- current = "<b>\u2190</b>";
- pango_layout_set_markup (steps->check_mark_layout, check, -1);
- pango_layout_set_markup (steps->current_mark_layout, current, -1);
+ steps->todo_mark_layout = pango_layout_new (context);
+ pango_layout_set_text (steps->check_mark_layout, check, -1);
+ pango_layout_set_text (steps->current_mark_layout, current, -1);
+ pango_layout_set_text (steps->todo_mark_layout, todo, -1);
steps->current_mark_timeout_id = steps->current_mark_frame = 0;
}
@@ -50,7 +51,9 @@
steps->check_mark_layout = NULL;
if (steps->current_mark_layout)
g_object_unref (steps->current_mark_layout);
- steps->current_mark_layout = NULL;
+ if (steps->todo_mark_layout)
+ g_object_unref (steps->todo_mark_layout);
+ steps->todo_mark_layout = NULL;
GTK_OBJECT_CLASS (ygtk_steps_parent_class)->destroy (object);
}
@@ -82,38 +85,44 @@
YGtkSteps *steps = YGTK_STEPS (widget);
gboolean reverse = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
- GtkStyle *style = gtk_widget_get_style (widget);
GList *children = gtk_container_get_children (GTK_CONTAINER (widget)), *i;
+
+ cairo_t *cr = gdk_cairo_create (event->window);
+ cairo_set_source_rgb (cr, 0, 0, 0);
int n = 0;
for (i = children; i; i = i->next, n++) {
- if (n <= steps->current_step) {
- GtkWidget *label = i->data;
- if (g_object_get_data (G_OBJECT (label), "is-header"))
- continue;
- PangoLayout *mark = (n == steps->current_step) ?
- steps->current_mark_layout : steps->check_mark_layout;
- int x = label->allocation.x, y = label->allocation.y;
- if (reverse) {
- PangoRectangle rect;
- pango_layout_get_pixel_extents (mark, NULL, &rect);
- x += label->allocation.width - rect.width - 4;
- }
+ GtkWidget *label = i->data;
+ if (g_object_get_data (G_OBJECT (label), "is-header"))
+ continue;
+ PangoLayout *layout;
+ if (n < steps->current_step)
+ layout = steps->check_mark_layout;
+ else if (n == steps->current_step)
+ layout = steps->current_mark_layout;
+ else //if (n > steps->current_step)
+ layout = steps->todo_mark_layout;
+ int x = label->allocation.x, y = label->allocation.y;
+ if (reverse) {
+ PangoRectangle rect;
+ pango_layout_get_pixel_extents (layout, NULL, &rect);
+ x += label->allocation.width - rect.width - 4;
+ }
+ else
+ x += 4;
+ if (n == steps->current_step) {
+ int offset;
+ if (steps->current_mark_frame < CURRENT_MARK_FRAMES_NB/2)
+ offset = steps->current_mark_frame * CURRENT_MARK_ANIMATION_OFFSET;
else
- x += 4;
- if (n == steps->current_step) {
- int offset;
- if (steps->current_mark_frame < CURRENT_MARK_FRAMES_NB/2)
- offset = steps->current_mark_frame * CURRENT_MARK_ANIMATION_OFFSET;
- else
- offset = (CURRENT_MARK_FRAMES_NB - steps->current_mark_frame) *
- CURRENT_MARK_ANIMATION_OFFSET;
- x += offset * (reverse ? 1 : -1);
- }
-
- gtk_paint_layout (style, widget->window, GTK_STATE_NORMAL, TRUE,
- NULL, /*event->area,*/ widget, NULL, x, y, mark);
+ offset = (CURRENT_MARK_FRAMES_NB - steps->current_mark_frame) *
+ CURRENT_MARK_ANIMATION_OFFSET;
+ x += offset * (reverse ? 1 : -1);
}
+
+ cairo_move_to (cr, x, y);
+ pango_cairo_show_layout (cr, layout);
}
+ cairo_destroy (cr);
g_list_free (children);
return FALSE;
}
@@ -126,6 +135,8 @@
gint ygtk_steps_append (YGtkSteps *steps, const gchar *text)
{
GtkWidget *label = gtk_label_new (text);
+ GdkColor black = { 0, 0, 0, 0 };
+ gtk_widget_modify_fg (label, GTK_STATE_NORMAL, &black);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
int mark_width = 10;
pango_layout_get_pixel_size (steps->check_mark_layout, &mark_width, NULL);
@@ -138,6 +149,8 @@
void ygtk_steps_append_heading (YGtkSteps *steps, const gchar *heading)
{
GtkWidget *label = gtk_label_new (heading);
+ GdkColor black = { 0, 0, 0, 0 };
+ gtk_widget_modify_fg (label, GTK_STATE_NORMAL, &black);
g_object_set_data (G_OBJECT (label), "is-header", GINT_TO_POINTER (1));
gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
Modified: trunk/gtk/src/ygtksteps.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtksteps.h?rev=59804&r1…
==============================================================================
--- trunk/gtk/src/ygtksteps.h (original)
+++ trunk/gtk/src/ygtksteps.h Thu Nov 26 18:14:14 2009
@@ -39,7 +39,7 @@
// private:
gint current_step;
- PangoLayout *check_mark_layout, *current_mark_layout;
+ PangoLayout *check_mark_layout, *current_mark_layout, *todo_mark_layout;
// for current_mark little animation
guint current_mark_timeout_id, current_mark_frame;
Modified: trunk/gtk/src/ygtktextview.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktextview.c?rev=59804…
==============================================================================
--- trunk/gtk/src/ygtktextview.c (original)
+++ trunk/gtk/src/ygtktextview.c Thu Nov 26 18:14:14 2009
@@ -65,6 +65,40 @@
gtk_widget_show_all (GTK_WIDGET (menu));
}
+static inline gboolean is_space (gunichar ch)
+{ return g_unichar_isspace (ch) || ch == 0xfffc; }
+
+static gboolean ygtk_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
+{ // on right-click, select word under cursor if there is no selection
+ if (event->button == 3) {
+ GtkTextView *view = GTK_TEXT_VIEW (widget);
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
+ if (!gtk_text_buffer_get_has_selection (buffer)) {
+ gint buffer_x, buffer_y;
+ gtk_text_view_window_to_buffer_coords (view,
+ GTK_TEXT_WINDOW_WIDGET, (gint) event->x, (gint) event->y, &buffer_x, &buffer_y);
+ GtkTextIter iter;
+ gtk_text_view_get_iter_at_location (view, &iter, buffer_x, buffer_y);
+
+ if (!is_space (gtk_text_iter_get_char (&iter))) {
+ GtkTextIter start, end = iter, temp = iter;
+ do {
+ start = temp;
+ if (!gtk_text_iter_backward_char (&temp))
+ break;
+ } while (!is_space (gtk_text_iter_get_char (&temp)));
+ do {
+ if (!gtk_text_iter_forward_char (&end))
+ break;
+ } while (!is_space (gtk_text_iter_get_char (&end)));
+
+ gtk_text_buffer_select_range (buffer, &start, &end);
+ }
+ }
+ }
+ return GTK_WIDGET_CLASS (ygtk_text_view_parent_class)->button_press_event (widget, event);
+}
+
GtkWidget *ygtk_text_view_new (gboolean editable)
{ return g_object_new (YGTK_TYPE_TEXT_VIEW, "editable", editable, NULL); }
@@ -75,5 +109,6 @@
GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->realize = ygtk_text_view_realize;
+ gtkwidget_class->button_press_event = ygtk_text_view_button_press_event;
}
Modified: trunk/gtk/src/ygtktreeview.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktreeview.c?rev=59804…
==============================================================================
--- trunk/gtk/src/ygtktreeview.c (original)
+++ trunk/gtk/src/ygtktreeview.c Thu Nov 26 18:14:14 2009
@@ -74,7 +74,7 @@
static void ygtk_tree_view_size_allocate (GtkWidget *widget, GtkAllocation *alloc)
{
GTK_WIDGET_CLASS (ygtk_tree_view_parent_class)->size_allocate (widget, alloc);
-
+#if 0 // this doesn't work so well on gtk 2.18.1
GtkTreeView *view = GTK_TREE_VIEW (widget);
GtkTreeSelection *selection = gtk_tree_view_get_selection (view);
GList *paths;
@@ -86,6 +86,7 @@
}
g_list_foreach (paths, (GFunc) gtk_tree_path_free, 0);
g_list_free (paths);
+#endif
}
Modified: trunk/gtk/src/ygtkwizard.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=59804&r…
==============================================================================
--- trunk/gtk/src/ygtkwizard.c (original)
+++ trunk/gtk/src/ygtkwizard.c Thu Nov 26 18:14:14 2009
@@ -66,7 +66,7 @@
GTK_WIDGET (dialog), GTK_STOCK_HELP, GTK_ICON_SIZE_MENU, NULL);
gtk_window_set_icon (GTK_WINDOW (dialog), icon);
g_object_unref (G_OBJECT (icon));
- gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 350);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 450);
// help text
dialog->help_box = gtk_scrolled_window_new (NULL, NULL);
@@ -491,16 +491,12 @@
static GtkWidget *create_help_button()
{
- GtkWidget *button, *image = 0;
+ GtkWidget *button, *image;
button = gtk_toggle_button_new();
gtk_button_set_label (GTK_BUTTON (button), _("Help"));
gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
- GdkPixbuf *pixbuf = gtk_widget_render_icon (button, GTK_STOCK_HELP, GTK_ICON_SIZE_BUTTON, NULL);
- if (pixbuf) {
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref (G_OBJECT (pixbuf));
- gtk_button_set_image (GTK_BUTTON (button), image);
- }
+ image = gtk_image_new_from_stock (GTK_STOCK_HELP, GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (button), image);
return button;
}
@@ -612,6 +608,7 @@
gtk_widget_set_size_request (wizard->m_buttons, 0, -1);
g_signal_connect_after (G_OBJECT (wizard->m_buttons), "size-allocate",
G_CALLBACK (buttons_size_allocate_cb), buttons_group);
+ wizard->m_default_button = NULL;
//** The menu and the navigation widgets will be created when requested.
// space for them
@@ -644,8 +641,10 @@
{
GTK_WIDGET_CLASS (ygtk_wizard_parent_class)->realize (widget);
YGtkWizard *wizard = YGTK_WIZARD (widget);
- gtk_widget_grab_default (wizard->next_button);
- gtk_widget_grab_focus (wizard->next_button);
+ if (wizard->m_default_button) {
+ gtk_widget_grab_default (wizard->m_default_button);
+ gtk_widget_grab_focus (wizard->m_default_button);
+ }
}
static void ygtk_wizard_map (GtkWidget *widget)
@@ -671,10 +670,8 @@
*hash = NULL;
}
-static void ygtk_wizard_destroy (GtkObject *object)
+static void ygtk_wizard_finalize (GObject *object)
{
- GTK_OBJECT_CLASS (ygtk_wizard_parent_class)->destroy (object);
-
YGtkWizard *wizard = YGTK_WIZARD (object);
wizard->help_button = NULL; // dialog unmap will try to access this
destroy_hash (&wizard->menu_ids, FALSE);
@@ -684,6 +681,7 @@
ygtk_help_text_destroy (wizard->m_help);
wizard->m_help = NULL;
}
+ G_OBJECT_CLASS (ygtk_wizard_parent_class)->finalize (object);
}
GtkWidget *ygtk_wizard_new (void)
@@ -702,10 +700,13 @@
g_signal_emit (wizard, action_triggered_signal, 0, id, G_TYPE_STRING);
}
-void ygtk_wizard_set_child (YGtkWizard *wizard, GtkWidget *widget)
+void ygtk_wizard_set_child (YGtkWizard *wizard, GtkWidget *child)
{
- wizard->m_child = widget;
- gtk_paned_pack2 (GTK_PANED (wizard->m_pane), widget, TRUE, TRUE);
+ if (wizard->m_child)
+ gtk_container_remove (GTK_CONTAINER (wizard->m_pane), wizard->m_child);
+ wizard->m_child = child;
+ if (child)
+ gtk_paned_pack2 (GTK_PANED (wizard->m_pane), child, TRUE, TRUE);
}
static gboolean ygtk_wizard_set_information_expose_cb (GtkWidget *widget, GdkEventExpose *event,
@@ -899,6 +900,9 @@
g_object_set_data (G_OBJECT (button), "ptr-id", id);
}
+void ygtk_wizard_set_default_button (YGtkWizard *wizard, GtkWidget *button)
+{ wizard->m_default_button = button; }
+
void ygtk_wizard_enable_button (YGtkWizard *wizard, GtkWidget *button, gboolean enable)
{
gtk_widget_set_sensitive (button, enable);
@@ -1075,8 +1079,8 @@
widget_class->realize = ygtk_wizard_realize;
widget_class->map = ygtk_wizard_map;
- GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
- gtkobject_class->destroy = ygtk_wizard_destroy;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = ygtk_wizard_finalize;
action_triggered_signal = g_signal_new ("action-triggered",
G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST,
Modified: trunk/gtk/src/ygtkwizard.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.h?rev=59804&r…
==============================================================================
--- trunk/gtk/src/ygtkwizard.h (original)
+++ trunk/gtk/src/ygtkwizard.h Thu Nov 26 18:14:14 2009
@@ -105,7 +105,7 @@
/* Widgets we need to access. */
GtkWidget *tree_view, *steps, *menu,
*back_button, *abort_button, *next_button, *help_button,
- *release_notes_button;
+ *release_notes_button, *m_default_button;
/* The help text. */
YGtkHelpText *m_help;
@@ -150,6 +150,7 @@
const char *id);
void ygtk_wizard_set_button_ptr_id (YGtkWizard *wizard, GtkWidget *button,
gpointer id);
+void ygtk_wizard_set_default_button (YGtkWizard *wizard, GtkWidget *button); // before realize
void ygtk_wizard_set_extra_button (YGtkWizard *wizard, GtkWidget *widget);
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r59803 - /trunk/gtk/package/yast2-gtk-rpmlintrc
by rpmcruz@svn.opensuse.org 26 Nov '09
by rpmcruz@svn.opensuse.org 26 Nov '09
26 Nov '09
Author: rpmcruz
Date: Thu Nov 26 18:10:57 2009
New Revision: 59803
URL: http://svn.opensuse.org/viewcvs/yast?rev=59803&view=rev
Log:
* Reverted to development state.
Removed:
trunk/gtk/package/yast2-gtk-rpmlintrc
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r59802 - in /trunk/gtk/modules: ./ FindGTK2.cmake
by rpmcruz@svn.opensuse.org 26 Nov '09
by rpmcruz@svn.opensuse.org 26 Nov '09
26 Nov '09
Author: rpmcruz
Date: Thu Nov 26 18:10:24 2009
New Revision: 59802
URL: http://svn.opensuse.org/viewcvs/yast?rev=59802&view=rev
Log:
* Reverted to development state.
Added:
trunk/gtk/modules/
trunk/gtk/modules/FindGTK2.cmake
Added: trunk/gtk/modules/FindGTK2.cmake
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/modules/FindGTK2.cmake?rev=5…
==============================================================================
--- trunk/gtk/modules/FindGTK2.cmake (added)
+++ trunk/gtk/modules/FindGTK2.cmake Thu Nov 26 18:10:24 2009
@@ -0,0 +1,546 @@
+# - FindGTK2.cmake
+# This module can find the GTK2 widget libraries and several of its other
+# optional components like gtkmm, glade, and glademm.
+#
+# NOTE: If you intend to use version checking, CMake 2.6.2 or later is
+# required.
+#
+# Specify one or more of the following components
+# as you call this find module. See example below.
+#
+# gtk
+# gtkmm
+# glade
+# glademm
+#
+# The following variables will be defined for your use
+#
+# GTK2_FOUND - Were all of your specified components found?
+# GTK2_INCLUDE_DIRS - All include directories
+# GTK2_LIBRARIES - All libraries
+#
+# GTK2_VERSION - The version of GTK2 found (x.y.z)
+# GTK2_MAJOR_VERSION - The major version of GTK2
+# GTK2_MINOR_VERSION - The minor version of GTK2
+# GTK2_PATCH_VERSION - The patch version of GTK2
+#
+# Optional variables you can define prior to calling this module:
+#
+# GTK2_DEBUG - Enables verbose debugging of the module
+# GTK2_SKIP_MARK_AS_ADVANCED - Disable marking cache variables as advanced
+#
+#=================
+# Example Usage:
+#
+# Call find_package() once, here are some examples to pick from:
+#
+# Require GTK 2.6 or later
+# find_package(GTK2 2.6 REQUIRED gtk)
+#
+# Require GTK 2.10 or later and Glade
+# find_package(GTK2 2.10 REQUIRED gtk glade)
+#
+# Search for GTK/GTKMM 2.8 or later
+# find_package(GTK2 2.8 COMPONENTS gtk gtkmm)
+#
+# if(GTK2_FOUND)
+# include_directories(${GTK2_INCLUDE_DIRS})
+# add_executable(mygui mygui.cc)
+# target_link_libraries(mygui ${GTK2_LIBRARIES})
+# endif()
+#
+
+#=============================================================================
+# Copyright 2009 Kitware, Inc.
+# Copyright 2008-2009 Philip Lowman <philip(a)yhbt.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Version 0.7 (3/22/09)
+# * Checked into CMake CVS
+# * Added versioning support
+# * Module now defaults to searching for GTK if COMPONENTS not specified.
+# * Added HKCU prior to HKLM registry key and GTKMM specific environment
+# variable as per mailing list discussion.
+# * Added lib64 to include search path and a few other search paths where GTK
+# may be installed on Unix systems.
+# * Switched to lowercase CMake commands
+# * Prefaced internal variables with _GTK2 to prevent collision
+# * Changed internal macros to functions
+# * Enhanced documentation
+# Version 0.6 (1/8/08)
+# Added GTK2_SKIP_MARK_AS_ADVANCED option
+# Version 0.5 (12/19/08)
+# Second release to cmake mailing list
+
+#=============================================================
+# _GTK2_GET_VERSION
+# Internal function to parse the version number in gtkversion.h
+# _OUT_major = Major version number
+# _OUT_minor = Minor version number
+# _OUT_micro = Micro version number
+# _gtkversion_hdr = Header file to parse
+#=============================================================
+function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr)
+ file(READ ${_gtkversion_hdr} _contents)
+ if(_contents)
+ string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}")
+ string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}")
+ string(REGEX REPLACE ".*#define GTK_MICRO_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_micro} "${_contents}")
+
+ if(NOT ${_OUT_major} MATCHES "[0-9]+")
+ message(FATAL_ERROR "Version parsing failed for GTK2_MAJOR_VERSION!")
+ endif()
+ if(NOT ${_OUT_minor} MATCHES "[0-9]+")
+ message(FATAL_ERROR "Version parsing failed for GTK2_MINOR_VERSION!")
+ endif()
+ if(NOT ${_OUT_micro} MATCHES "[0-9]+")
+ message(FATAL_ERROR "Version parsing failed for GTK2_MICRO_VERSION!")
+ endif()
+
+ set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE)
+ set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE)
+ set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE)
+ else()
+ message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist")
+ endif()
+endfunction()
+
+#=============================================================
+# _GTK2_FIND_INCLUDE_DIR
+# Internal function to find the GTK include directories
+# _var = variable to set
+# _hdr = header file to look for
+#=============================================================
+function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_FIND_INCLUDE_DIR( ${_var} ${_hdr} )")
+ endif()
+
+ set(_relatives
+ # FIXME
+ glibmm-2.4
+ glib-2.0
+ atk-1.0
+ atkmm-1.6
+ cairo
+ cairomm-1.0
+ gdkmm-2.4
+ giomm-2.4
+ gtk-2.0
+ gtkmm-2.4
+ libglade-2.0
+ libglademm-2.4
+ pango-1.0
+ pangomm-1.4
+ sigc++-2.0
+ )
+
+ set(_suffixes)
+ foreach(_d ${_relatives})
+ list(APPEND _suffixes ${_d})
+ list(APPEND _suffixes ${_d}/include) # for /usr/lib/gtk-2.0/include
+ endforeach()
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "include suffixes = ${_suffixes}")
+ endif()
+
+ find_path(${_var} ${_hdr}
+ PATHS
+ /usr/local/lib64
+ /usr/local/lib
+ /usr/lib64
+ /usr/lib
+ /opt/gnome/include
+ /opt/gnome/lib
+ /opt/openwin/include
+ /usr/openwin/lib
+ $ENV{GTKMM_BASEPATH}/include
+ $ENV{GTKMM_BASEPATH}/lib
+ [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include
+ [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/include
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ PATH_SUFFIXES
+ ${_suffixes}
+ )
+
+ if(${_var})
+ set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${${_var}} PARENT_SCOPE)
+ if(NOT GTK2_SKIP_MARK_AS_ADVANCED)
+ mark_as_advanced(${_var})
+ endif()
+ endif()
+
+endfunction(_GTK2_FIND_INCLUDE_DIR)
+
+#=============================================================
+# _GTK2_FIND_LIBRARY
+# Internal function to find libraries packaged with GTK2
+# _var = library variable to create
+#=============================================================
+function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "_GTK2_FIND_LIBRARY( ${_var} ${_lib} ${_expand_vc} ${_append_version} )")
+ endif()
+
+ # Not GTK versions per se but the versions encoded into Windows
+ # import libraries (GtkMM 2.14.1 has a gtkmm-vc80-2_4.lib for example)
+ # Also the MSVC libraries use _ for . (this is handled below)
+ set(_versions 2.20 2.18 2.16 2.14 2.12
+ 2.10 2.8 2.6 2.4 2.2 2.0
+ 1.20 1.18 1.16 1.14 1.12
+ 1.10 1.8 1.6 1.4 1.2 1.0)
+
+ set(_library)
+ set(_library_d)
+
+ set(_library ${_lib})
+
+ if(_expand_vc)
+ # Add vc80/vc90 midfixes
+ if(MSVC80)
+ set(_library ${_library}-vc80)
+ set(_library_d ${_library}-d)
+ elseif(MSVC90)
+ set(_library ${_library}-vc90)
+ set(_library_d ${_library}-d)
+ endif()
+ endif()
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "After midfix addition = ${_library} and ${_library_d}")
+ endif()
+
+ set(_lib_list)
+ set(_libd_list)
+ if(_append_version)
+ foreach(_ver ${_versions})
+ list(APPEND _lib_list "${_library}-${_ver}")
+ list(APPEND _libd_list "${_library_d}-${_ver}")
+ endforeach()
+ else()
+ set(_lib_list ${_library})
+ set(_libd_list ${_library_d})
+ endif()
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "library list = ${_lib_list} and library debug list = ${_libd_list}")
+ endif()
+
+ # For some silly reason the MSVC libraries use _ instead of .
+ # in the version fields
+ if(_expand_vc AND MSVC)
+ set(_no_dots_lib_list)
+ set(_no_dots_libd_list)
+ foreach(_l ${_lib_list})
+ string(REPLACE "." "_" _no_dots_library ${_l})
+ list(APPEND _no_dots_lib_list ${_no_dots_library})
+ endforeach()
+ # And for debug
+ set(_no_dots_libsd_list)
+ foreach(_l ${_libd_list})
+ string(REPLACE "." "_" _no_dots_libraryd ${_l})
+ list(APPEND _no_dots_libd_list ${_no_dots_libraryd})
+ endforeach()
+
+ # Copy list back to original names
+ set(_lib_list ${_no_dots_lib_list})
+ set(_libd_list ${_no_dots_libd_list})
+ endif()
+
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "While searching for ${_var}, our proposed library list is ${_lib_list}")
+ endif()
+
+ find_library(${_var}
+ NAMES ${_lib_list}
+ PATHS
+ /opt/gnome/lib
+ /opt/gnome/lib64
+ /usr/openwin/lib
+ /usr/openwin/lib64
+ $ENV{GTKMM_BASEPATH}/lib
+ [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ )
+
+ if(_expand_vc AND MSVC)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "While searching for ${_var}_DEBUG our proposed library list is ${_libd_list}")
+ endif()
+
+ find_library(${_var}_DEBUG
+ NAMES ${_libd_list}
+ PATHS
+ $ENV{GTKMM_BASEPATH}/lib
+ [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
+ )
+
+ if(${_var} AND ${_var}_DEBUG)
+ if(NOT GTK2_SKIP_MARK_AS_ADVANCED)
+ mark_as_advanced(${_var}_DEBUG)
+ endif()
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} optimized ${${_var}} debug ${${_var}_DEBUG})
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE)
+ endif()
+ else()
+ if(NOT GTK2_SKIP_MARK_AS_ADVANCED)
+ mark_as_advanced(${_var})
+ endif()
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${${_var}})
+ set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE)
+ # Set debug to release
+ set(${_var}_DEBUG ${${_var}})
+ set(${_var}_DEBUG ${${_var}} PARENT_SCOPE)
+ endif()
+endfunction(_GTK2_FIND_LIBRARY)
+
+#=============================================================
+
+#
+# main()
+#
+
+set(GTK2_FOUND)
+set(GTK2_INCLUDE_DIRS)
+set(GTK2_LIBRARIES)
+
+if(NOT GTK2_FIND_COMPONENTS)
+ # Assume they only want GTK
+ set(GTK2_FIND_COMPONENTS gtk)
+endif()
+
+#
+# If specified, enforce version number
+#
+if(GTK2_FIND_VERSION)
+ cmake_minimum_required(VERSION 2.6.2)
+ set(GTK2_FAILED_VERSION_CHECK true)
+ if(GTK2_DEBUG)
+ message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
+ "Searching for version ${GTK2_FIND_VERSION}")
+ endif()
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.h)
+ if(GTK2_GTK_INCLUDE_DIR)
+ _GTK2_GET_VERSION(GTK2_MAJOR_VERSION
+ GTK2_MINOR_VERSION
+ GTK2_PATCH_VERSION
+ ${GTK2_GTK_INCLUDE_DIR}/gtk/gtkversion.h)
+ set(GTK2_VERSION
+ ${GTK2_MAJOR_VERSION}.${GTK2_MINOR_VERSION}.${GTK2_PATCH_VERSION})
+ if(GTK2_FIND_VERSION_EXACT)
+ if(GTK2_VERSION VERSION_EQUAL GTK2_FIND_VERSION)
+ set(GTK2_FAILED_VERSION_CHECK false)
+ endif()
+ else()
+ if(GTK2_VERSION VERSION_EQUAL GTK2_FIND_VERSION OR
+ GTK2_VERSION VERSION_GREATER GTK2_FIND_VERSION)
+ set(GTK2_FAILED_VERSION_CHECK false)
+ endif()
+ endif()
+ else()
+ # If we can't find the GTK include dir, we can't do version checking
+ if(GTK2_FIND_REQUIRED AND NOT GTK2_FIND_QUIETLY)
+ message(FATAL_ERROR "Could not find GTK2 include directory")
+ endif()
+ return()
+ endif()
+
+ if(GTK2_FAILED_VERSION_CHECK)
+ if(GTK2_FIND_REQUIRED AND NOT GTK2_FIND_QUIETLY)
+ if(GTK2_FIND_VERSION_EXACT)
+ message(FATAL_ERROR "GTK2 version check failed. Version ${GTK2_VERSION} was found, version ${GTK2_FIND_VERSION} is needed exactly.")
+ else()
+ message(FATAL_ERROR "GTK2 version check failed. Version ${GTK2_VERSION} was found, at least version ${GTK2_FIND_VERSION} is required")
+ endif()
+ endif()
+
+ # If the version check fails, exit out of the module here
+ return()
+ endif()
+endif()
+
+#
+# Find all components
+#
+
+foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
+ if(_GTK2_component STREQUAL "gtk")
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB_INCLUDE_DIR glib.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG_INCLUDE_DIR glibconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GLIB_LIBRARY glib false true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_INCLUDE_DIR gdk/gdk.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-x11 false true)
+ _GTK2_FIND_LIBRARY (GTK2_GDK_LIBRARY gdk-win32 false true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.h)
+ _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-x11 false true)
+ _GTK2_FIND_LIBRARY (GTK2_GTK_LIBRARY gtk-win32 false true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO_INCLUDE_DIR cairo.h)
+ _GTK2_FIND_LIBRARY (GTK2_CAIRO_LIBRARY cairo false false)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO_INCLUDE_DIR pango/pango.h)
+ _GTK2_FIND_LIBRARY (GTK2_PANGO_LIBRARY pango false true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h)
+ _GTK2_FIND_LIBRARY (GTK2_ATK_LIBRARY atk false true)
+
+ #elseif(_GTK2_component STREQUAL "gdk_pixbuf")
+ #_GTK2_FIND_INCLUDE_DIR(GTK2_GDKPIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h)
+ #_GTK2_FIND_LIBRARY (GTK2_GDKPIXBUF_LIBRARY gdk_pixbuf false true)
+
+ elseif(_GTK2_component STREQUAL "gtkmm")
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM_INCLUDE_DIR glibmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG_INCLUDE_DIR glibmmconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GLIBMM_LIBRARY glibmm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM_INCLUDE_DIR gdkmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG_INCLUDE_DIR gdkmmconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GDKMM_LIBRARY gdkmm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMM_INCLUDE_DIR gtkmm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMMCONFIG_INCLUDE_DIR gtkmmconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GTKMM_LIBRARY gtkmm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM_INCLUDE_DIR cairomm/cairomm.h)
+ _GTK2_FIND_LIBRARY (GTK2_CAIROMM_LIBRARY cairomm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM_INCLUDE_DIR pangomm.h)
+ _GTK2_FIND_LIBRARY (GTK2_PANGOMM_LIBRARY pangomm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++_INCLUDE_DIR sigc++/sigc++.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG_INCLUDE_DIR sigc++config.h)
+ _GTK2_FIND_LIBRARY (GTK2_SIGC++_LIBRARY sigc true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMM_INCLUDE_DIR giomm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMMCONFIG_INCLUDE_DIR giommconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GIOMM_LIBRARY giomm true true)
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_ATKMM_INCLUDE_DIR atkmm.h)
+ _GTK2_FIND_LIBRARY (GTK2_ATKMM_LIBRARY atkmm true true)
+
+ elseif(_GTK2_component STREQUAL "glade")
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLADE_INCLUDE_DIR glade/glade.h)
+ _GTK2_FIND_LIBRARY (GTK2_GLADE_LIBRARY glade false true)
+
+ elseif(_GTK2_component STREQUAL "glademm")
+
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMM_INCLUDE_DIR libglademm.h)
+ _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMMCONFIG_INCLUDE_DIR libglademmconfig.h)
+ _GTK2_FIND_LIBRARY (GTK2_GLADEMM_LIBRARY glademm true true)
+
+ else()
+ message(FATAL_ERROR "Unknown GTK2 component ${_component}")
+ endif()
+endforeach()
+
+#
+# Solve for the GTK2 version if we haven't already
+#
+if(NOT GTK2_FIND_VERSION AND GTK2_GTK_INCLUDE_DIR)
+ _GTK2_GET_VERSION(GTK2_MAJOR_VERSION
+ GTK2_MINOR_VERSION
+ GTK2_PATCH_VERSION
+ ${GTK2_GTK_INCLUDE_DIR}/gtk/gtkversion.h)
+ set(GTK2_VERSION ${GTK2_MAJOR_VERSION}.${GTK2_MINOR_VERSION}.${GTK2_PATCH_VERSION})
+endif()
+
+#
+# Try to enforce components
+#
+
+set(_GTK2_did_we_find_everything true) # This gets set to GTK2_FOUND
+
+include(FindPackageHandleStandardArgs)
+
+foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
+ string(TOUPPER ${_GTK2_component} _COMPONENT_UPPER)
+
+ if(_GTK2_component STREQUAL "gtk")
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found."
+ GTK2_GTK_LIBRARY
+ GTK2_GTK_INCLUDE_DIR
+
+ GTK2_GLIB_INCLUDE_DIR
+ GTK2_GLIBCONFIG_INCLUDE_DIR
+ GTK2_GLIB_LIBRARY
+
+ GTK2_GDK_INCLUDE_DIR
+ GTK2_GDKCONFIG_INCLUDE_DIR
+ GTK2_GDK_LIBRARY
+ )
+ elseif(_GTK2_component STREQUAL "gtkmm")
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtkmm libraries were not found."
+ GTK2_GTKMM_LIBRARY
+ GTK2_GTKMM_INCLUDE_DIR
+ GTK2_GTKMMCONFIG_INCLUDE_DIR
+
+ GTK2_GLIBMM_INCLUDE_DIR
+ GTK2_GLIBMMCONFIG_INCLUDE_DIR
+ GTK2_GLIBMM_LIBRARY
+
+ GTK2_GDKMM_INCLUDE_DIR
+ GTK2_GDKMMCONFIG_INCLUDE_DIR
+ GTK2_GDKMM_LIBRARY
+ )
+ elseif(_GTK2_component STREQUAL "glade")
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glade library was not found."
+ GTK2_GLADE_LIBRARY
+ GTK2_GLADE_INCLUDE_DIR
+ )
+ elseif(_GTK2_component STREQUAL "glademm")
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glademm library was not found."
+ GTK2_GLADEMM_LIBRARY
+ GTK2_GLADEMM_INCLUDE_DIR
+ GTK2_GLADEMMCONFIG_INCLUDE_DIR
+ )
+ endif()
+
+ if(NOT GTK2_${_COMPONENT_UPPER}_FOUND)
+ set(_GTK2_did_we_find_everything false)
+ endif()
+endforeach()
+
+if(_GTK2_did_we_find_everything AND NOT GTK2_VERSION_CHECK_FAILED)
+ set(GTK2_FOUND true)
+else()
+ # Unset our variables.
+ set(GTK2_FOUND false)
+ set(GTK2_VERSION)
+ set(GTK2_VERSION_MAJOR)
+ set(GTK2_VERSION_MINOR)
+ set(GTK2_VERSION_PATCH)
+ set(GTK2_INCLUDE_DIRS)
+ set(GTK2_LIBRARIES)
+endif()
+
+if(GTK2_INCLUDE_DIRS)
+ list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS)
+endif()
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r59801 - /branches/SuSE-Code-11-SP1-Branch/network/src/lan/help.ycp
by kmachalkova@svn.opensuse.org 26 Nov '09
by kmachalkova@svn.opensuse.org 26 Nov '09
26 Nov '09
Author: kmachalkova
Date: Thu Nov 26 17:41:25 2009
New Revision: 59801
URL: http://svn.opensuse.org/viewcvs/yast?rev=59801&view=rev
Log:
Help++
Modified:
branches/SuSE-Code-11-SP1-Branch/network/src/lan/help.ycp
Modified: branches/SuSE-Code-11-SP1-Branch/network/src/lan/help.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/netwo…
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/network/src/lan/help.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/network/src/lan/help.ycp Thu Nov 26 17:41:25 2009
@@ -75,10 +75,16 @@
_("<p>For each route, enter destination network IP address, gateway address,
and netmask. To omit any of these values, use dash sign \"-\". Select
-the device through which the traffic to the defined network will be routed, as well.\"-\" is an alias for any interface.</p>
+the device through which the traffic to the defined network will be routed,
+as well.\"-\" is an alias for any interface.</p>
") +
/* Routing dialog help 2/2 */
-_("<p>Enable <b>IP Forwarding</b> if the system is a router. This will apply on both IPv4 and IPv6.</p>"),
+_("<p>Enable <b>IP Forwarding</b> (forwarding packets from external networks
+to the internal one) if this system is a router. Both IPv4 and IPv6 connectivity
+will be affected by this setting.
+<b>Important:</b> if the firewall is enabled, allowing IP forwarding alone is not enough.
+You should enable masquerade and/or set at least one redirect rule in firewall. You may
+use YaST firewall module for that.</p>"),
"dhcp_hostname":
_("<p>If you are using DHCP to get an IP address, check whether you get
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r59800 - /branches/SuSE-Code-11-SP1-Branch/network/src/modules/Routing.ycp
by kmachalkova@svn.opensuse.org 26 Nov '09
by kmachalkova@svn.opensuse.org 26 Nov '09
26 Nov '09
Author: kmachalkova
Date: Thu Nov 26 17:29:37 2009
New Revision: 59800
URL: http://svn.opensuse.org/viewcvs/yast?rev=59800&view=rev
Log:
With enabled firewall, use Get/SetSupportRoute
from SuSEFirewall (avoid overwriting ip_forwarding
by SuSEFirewall init scripts)
Modified:
branches/SuSE-Code-11-SP1-Branch/network/src/modules/Routing.ycp
Modified: branches/SuSE-Code-11-SP1-Branch/network/src/modules/Routing.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/netwo…
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/network/src/modules/Routing.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/network/src/modules/Routing.ycp Thu Nov 26 17:29:37 2009
@@ -18,6 +18,7 @@
import "NetHwDetection";
import "NetworkInterfaces";
import "Map";
+import "SuSEFirewall";
include "network/runtime.ycp";
include "network/routines.ycp";
@@ -91,6 +92,30 @@
Routes = route;
}
+void ReadIPForwarding() {
+ if ( SuSEFirewall::IsEnabled() ){
+ Forward = SuSEFirewall::GetSupportRoute();
+ }
+ else {
+ Forward = (SCR::Read(.sysconfig.sysctl.IP_FORWARD) == "yes");
+ }
+}
+
+void WriteIPForwarding() {
+ if ( SuSEFirewall::IsEnabled() ){
+ SuSEFirewall::SetSupportRoute( Forward );
+ }
+ else {
+ SCR::Write(.sysconfig.sysctl.IP_FORWARD, Forward ? "yes" : "no");
+ SCR::Write(.sysconfig.sysctl.IPV6_FORWARD, Forward ? "yes" : "no");
+ SCR::Write(.sysconfig.sysctl, nil);
+ }
+ SCR::Execute(.target.bash, sformat("echo %1 > /proc/sys/net/ipv4/ip_forward",
+ Forward ? 1 : 0));
+ SCR::Execute(.target.bash, sformat("echo %1 > /proc/sys/net/ipv6/conf/all/forwarding",
+ Forward ? 1 : 0));
+
+}
/**
* Read routing settings
@@ -105,9 +130,7 @@
else
Routes = [];
- /* enabled IP forwarding */
- if(SCR::Read(.sysconfig.sysctl.IP_FORWARD) == "yes")
- Forward = true;
+ ReadIPForwarding();
y2debug("Routes=%1", Routes);
y2debug("Forward=%1", Forward);
@@ -154,18 +177,7 @@
/*Progress stage 1/2*/
ProgressNextStage(_("Writing IP forwarding settings..."));
- if(Forward) {
- SCR::Write(.sysconfig.sysctl.IP_FORWARD, "yes");
- SCR::Write(.sysconfig.sysctl.IPV6_FORWARD, "yes");
- SCR::Execute(.target.bash, "echo 1 > /proc/sys/net/ipv4/ip_forward");
- SCR::Execute(.target.bash, "echo 1 > /proc/sys/net/ipv6/conf/all/forwarding");
- }
- else {
- SCR::Write(.sysconfig.sysctl.IP_FORWARD, "no");
- SCR::Write(.sysconfig.sysctl.IPV6_FORWARD, "no");
- SCR::Execute(.target.bash, "echo 0 > /proc/sys/net/ipv4/ip_forward");
- SCR::Execute(.target.bash, "echo 0 > /proc/sys/net/ipv6/conf/all/forwarding");
- }
+ WriteIPForwarding();
sleep(sl);
/* at first stop the running routes */
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r59799 - in /trunk/storage: package/yast2-storage.changes storage/src/include/custom_part_dialogs.ycp
by fehr@svn.opensuse.org 26 Nov '09
by fehr@svn.opensuse.org 26 Nov '09
26 Nov '09
Author: fehr
Date: Thu Nov 26 17:04:49 2009
New Revision: 59799
URL: http://svn.opensuse.org/viewcvs/yast?rev=59799&view=rev
Log:
disable impossible mountby methods (#444328)
Modified:
trunk/storage/package/yast2-storage.changes
trunk/storage/storage/src/include/custom_part_dialogs.ycp
Modified: trunk/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.ch…
==============================================================================
--- trunk/storage/package/yast2-storage.changes (original)
+++ trunk/storage/package/yast2-storage.changes Thu Nov 26 17:04:49 2009
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Thu Nov 26 17:07:16 CET 2009 - fehr(a)suse.de
+
+- disable impossible mountby methods (#444328)
+
+-------------------------------------------------------------------
Tue Nov 24 17:13:39 CET 2009 - fehr(a)suse.de
- do not format hfs boot partition on mac systems (#447782)
Modified: trunk/storage/storage/src/include/custom_part_dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/cust…
==============================================================================
--- trunk/storage/storage/src/include/custom_part_dialogs.ycp (original)
+++ trunk/storage/storage/src/include/custom_part_dialogs.ycp Thu Nov 26 17:04:49 2009
@@ -684,21 +684,27 @@
{
list no_mountby_type = [ `loop ];
list mountby_id_path_type = [ `primary, `logical ];
+ map enab = $[];
+ boolean tmp = !contains( no_mountby_type, new["type"]:`primary );
+ enab[`label] = tmp && FileSystems::MountLabel( new["used_fs"]:`unknown ) &&
+ new["enc_type"]:`none==`none;
+ enab[`uuid] = tmp && (new["format"]:false || size(new["uuid"]:"")>0) &&
+ FileSystems::MountUuid( new["used_fs"]:`unknown );
+ tmp = contains(mountby_id_path_type, new["type"]:`none);
+ enab[`id] = tmp && size(new["udev_id"]:[])>0;
+ enab[`path] = tmp && size(new["udev_path"]:"")>0;
+ y2milestone( "FstabOptions enab %1", enab );
+ UI::ChangeWidget( `id(`label), `Enabled, enab[`label]:false );
+ UI::ChangeWidget( `id(`uuid), `Enabled, enab[`uuid]:false );
+ UI::ChangeWidget( `id(`id), `Enabled, enab[`id]:false );
+ UI::ChangeWidget( `id(`path), `Enabled, enab[`path]:false );
symbol defmb = !Mode::config() ? Storage::GetMountBy( new["device"]:"" )
: `device;
y2milestone( "FstabOptions defmb %1", defmb );
+ if( haskey( enab, defmb ) && !enab[defmb]:false )
+ defmb = `device;
UI::ChangeWidget( `id(`mt_group), `CurrentButton,
new["mountby"]:defmb );
- UI::ChangeWidget( `id(`label), `Enabled,
- FileSystems::MountLabel( new["used_fs"]:`unknown ) &&
- new["enc_type"]:`none==`none &&
- !contains( no_mountby_type, new["type"]:`primary ) );
- UI::ChangeWidget( `id(`uuid), `Enabled,
- (new["format"]:false || size(new["uuid"]:"")>0) &&
- FileSystems::MountUuid( new["used_fs"]:`unknown ) &&
- !contains( no_mountby_type, new["type"]:`primary ) );
- UI::ChangeWidget( `id(`id), `Enabled, contains(mountby_id_path_type, new["type"]:`none) );
- UI::ChangeWidget( `id(`path), `Enabled, contains(mountby_id_path_type, new["type"]:`none) );
}
if( UI::WidgetExists( `id(`vol_label) ))
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
Author: jsuchome
Date: Thu Nov 26 16:26:46 2009
New Revision: 59798
URL: http://svn.opensuse.org/viewcvs/yast?rev=59798&view=rev
Log:
Created tag stable-2_19_0 for irda
Added:
tags/stable-2_19_0/irda/
- copied from r59797, trunk/irda/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r59797 - in /trunk/irda: VERSION package/yast2-irda.changes src/ui.ycp testsuite/.cvsignore
by jsuchome@svn.opensuse.org 26 Nov '09
by jsuchome@svn.opensuse.org 26 Nov '09
26 Nov '09
Author: jsuchome
Date: Thu Nov 26 16:26:34 2009
New Revision: 59797
URL: http://svn.opensuse.org/viewcvs/yast?rev=59797&view=rev
Log:
- check for `ok dialog return value (bnc#558525)
- 2.19.0
Modified:
trunk/irda/VERSION
trunk/irda/package/yast2-irda.changes
trunk/irda/src/ui.ycp
trunk/irda/testsuite/.cvsignore
Modified: trunk/irda/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/irda/VERSION?rev=59797&r1=59796&…
==============================================================================
--- trunk/irda/VERSION (original)
+++ trunk/irda/VERSION Thu Nov 26 16:26:34 2009
@@ -1 +1 @@
-2.18.1
+2.19.0
Modified: trunk/irda/package/yast2-irda.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/irda/package/yast2-irda.changes?…
==============================================================================
--- trunk/irda/package/yast2-irda.changes (original)
+++ trunk/irda/package/yast2-irda.changes Thu Nov 26 16:26:34 2009
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Nov 26 16:20:52 CET 2009 - jsuchome(a)suse.cz
+
+- check for `ok dialog return value (bnc#558525)
+- 2.19.0
+
+-------------------------------------------------------------------
Fri Sep 4 12:25:48 CEST 2009 - ug(a)suse.de
- fixed typo in the desktop file which makes yast2-schema fail
Modified: trunk/irda/src/ui.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/irda/src/ui.ycp?rev=59797&r1=597…
==============================================================================
--- trunk/irda/src/ui.ycp (original)
+++ trunk/irda/src/ui.ycp Thu Nov 26 16:26:34 2009
@@ -313,7 +313,7 @@
} while (!contains ([`back, `abort, `cancel, `next, `ok], ret));
- if (ret == `next &&
+ if ((ret == `next || ret == `ok) &&
(start != Irda::start || port != Irda::port ||
baud_rate != Irda::max_baud_rate))
{
@@ -336,7 +336,7 @@
Irda::Read ();
symbol ret = IrDADialog ();
- if (ret == `next || ret == `finish)
+ if (ret == `next || ret == `finish || ret == `ok)
{
Irda::Write ();
}
Modified: trunk/irda/testsuite/.cvsignore
URL: http://svn.opensuse.org/viewcvs/yast/trunk/irda/testsuite/.cvsignore?rev=59…
==============================================================================
--- trunk/irda/testsuite/.cvsignore (original)
+++ trunk/irda/testsuite/.cvsignore Thu Nov 26 16:26:34 2009
@@ -9,4 +9,3 @@
config
run
*.test
-tests
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r59796 - /branches/SuSE-Code-11-SP1-Branch/network/src/modules/Lan.ycp
by kmachalkova@svn.opensuse.org 26 Nov '09
by kmachalkova@svn.opensuse.org 26 Nov '09
26 Nov '09
Author: kmachalkova
Date: Thu Nov 26 16:17:10 2009
New Revision: 59796
URL: http://svn.opensuse.org/viewcvs/yast?rev=59796&view=rev
Log:
Read firewall before routing (because of IP
forwarding setup)
Modified:
branches/SuSE-Code-11-SP1-Branch/network/src/modules/Lan.ycp
Modified: branches/SuSE-Code-11-SP1-Branch/network/src/modules/Lan.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/netwo…
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/network/src/modules/Lan.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/network/src/modules/Lan.ycp Thu Nov 26 16:17:10 2009
@@ -195,13 +195,13 @@
/* Progress stage 4/9 */
_("Read network configuration"),
/* Progress stage 5/9 */
- _("Read routing configuration"),
+ _("Read firewall settings"),
/* Progress stage 6/9 */
_("Read hostname and DNS configuration"),
/* Progress stage 7/9 */
_("Read installation information"),
/* Progress stage 8/9 */
- _("Read firewall settings"),
+ _("Read routing configuration"),
/* Progress stage 9/9 */
_("Detect current status"),
], [], "");
@@ -263,8 +263,10 @@
if(Abort()) return false;
/* Progress step 5/9 */
- ProgressNextStage(_("Reading routing configuration..."));
- Routing::Read();
+ ProgressNextStage(_("Reading firewall settings..."));
+ boolean orig = Progress::set (false);
+ SuSEFirewall4Network::Read ();
+ Progress::set (orig);
sleep(sl);
if(Abort()) return false;
@@ -282,10 +284,8 @@
if(Abort()) return false;
/* Progress step 8/9 */
- ProgressNextStage(_("Reading firewall settings..."));
- boolean orig = Progress::set (false);
- SuSEFirewall4Network::Read ();
- Progress::set (orig);
+ ProgressNextStage(_("Reading routing configuration..."));
+ Routing::Read();
sleep(sl);
if(Abort()) return false;
@@ -448,7 +448,7 @@
if (Mode::installation() && NetworkService::IsManaged()) y2internal("Export sysconfig settings into NetworkManager %1", SCR::Execute(.target.bash_output, "/usr/lib/NetworkManager/nm-opensuse-sysconfig-merge --connections"));
y2internal("virt_net_proposal %1", virt_net_proposal);
- if (Stage::cont() && virt_net_proposal && (Linuxrc::usessh() || Linuxrc::vnc() || Linuxrc::display_ip())) {
+ if (Stage::cont() && virt_net_proposal && (Linuxrc::usessh() || Linuxrc::vnc() || Linuxrc::display_ip())) {
UI::OpenDialog(`opt(`decorated), `HBox(
`HSpacing(1),
`HCenter(`HSquash(`VBox(
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
26 Nov '09
ref: refs/heads/master
commit 29afc1b199db7925cb108c00db8f8d2a29c981ec
Author: Josef Reidinger <jreidinger(a)suse.cz>
Date: Thu Nov 26 16:01:40 2009 +0100
add test for bnc#555204
---
.../test/functional/status_controller_test.rb | 31 ++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/plugins/status/test/functional/status_controller_test.rb b/plugins/status/test/functional/status_controller_test.rb
index 0667737..ec7be25 100644
--- a/plugins/status/test/functional/status_controller_test.rb
+++ b/plugins/status/test/functional/status_controller_test.rb
@@ -100,4 +100,35 @@ ATTR_DATA = {
assert_valid_markup
assert assigns(:logs)
end
+
+OUT_SYNC_ERROR = <<EOF
+<error>
+ <type>COLLECTD_SYNC_ERROR</type>
+ <description>blba bla</description>
+</error>
+EOF
+
+class ResponseMock
+ def body
+ return OUT_SYNC_ERROR
+ end
+
+ def code
+ return "503"
+ end
+end
+
+#status module must survive collectd out of sync
+ def test_collectd_out_of_sync
+ YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.system.logs').returns(@logs_proxy)
+ sproxy = StatusProxy.new
+ YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.system.status').returns(sproxy)
+ sproxy.stubs(:find).raises(ActiveResource::ServerError.new(ResponseMock.new,""))
+ get :index
+
+ assert_response :success
+ assert_valid_markup
+ assert assigns(:logs)
+ end
+
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0