Author: rpmcruz Date: Sat Jul 23 07:43:30 2011 New Revision: 64969 URL: http://svn.opensuse.org/viewcvs/yast?rev=64969&view=rev Log: - ported to gtk3 (initial work by Duncan) - don't show unsupported packages when the list is empty (bnc#704103). - showing mnemonics characters (bnc#704102). Added: trunk/gtk/cmake/ trunk/gtk/cmake/modules/ trunk/gtk/cmake/modules/FindGTK3.cmake Modified: trunk/gtk/CMakeLists.txt trunk/gtk/package/yast2-gtk.changes trunk/gtk/src/CMakeLists.txt trunk/gtk/src/YGBarGraph.cc 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/YGLayout.cc trunk/gtk/src/YGProgressBar.cc trunk/gtk/src/YGPushButton.cc trunk/gtk/src/YGSelectionStore.h trunk/gtk/src/YGText.cc trunk/gtk/src/YGTreeView.cc trunk/gtk/src/YGUI.cc trunk/gtk/src/YGUI.h trunk/gtk/src/YGUtils.cc trunk/gtk/src/YGUtils.h trunk/gtk/src/YGWidget.cc trunk/gtk/src/pkg/CMakeLists.txt trunk/gtk/src/pkg/YGPackageSelector.cc trunk/gtk/src/pkg/ygtkcellrendererbutton.c trunk/gtk/src/pkg/ygtkcellrendererbutton.h trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c trunk/gtk/src/pkg/ygtkcellrenderersidebutton.h trunk/gtk/src/pkg/ygtkcellrenderertext.c trunk/gtk/src/pkg/ygtkcellrenderertext.h trunk/gtk/src/pkg/ygtkpkgdetailview.cc trunk/gtk/src/pkg/ygtkpkgdetailview.h trunk/gtk/src/pkg/ygtkpkgfilterview.h trunk/gtk/src/pkg/ygtkpkghistorydialog.cc trunk/gtk/src/pkg/ygtkpkghistorydialog.h trunk/gtk/src/pkg/ygtkpkglistview.cc trunk/gtk/src/pkg/ygtkpkglistview.h trunk/gtk/src/pkg/ygtkpkgmenubar.cc trunk/gtk/src/pkg/ygtkpkgmenubar.h trunk/gtk/src/pkg/ygtkpkgpatternview.h trunk/gtk/src/pkg/ygtkpkgproductdialog.cc trunk/gtk/src/pkg/ygtkpkgproductdialog.h trunk/gtk/src/pkg/ygtkpkgquerycombo.cc trunk/gtk/src/pkg/ygtkpkgquerycombo.h trunk/gtk/src/pkg/ygtkpkgquerywidget.h trunk/gtk/src/pkg/ygtkpkgrpmgroupsview.h trunk/gtk/src/pkg/ygtkpkgsearchentry.cc trunk/gtk/src/pkg/ygtkpkgstatusbar.cc trunk/gtk/src/pkg/ygtkpkgstatusbar.h trunk/gtk/src/pkg/ygtkpkgundolist.cc trunk/gtk/src/pkg/ygtkpkgvestigialdialog.h trunk/gtk/src/pkg/ygtktreemodel.h trunk/gtk/src/ygdkmngloader.c trunk/gtk/src/ygtkbargraph.c trunk/gtk/src/ygtkbargraph.h trunk/gtk/src/ygtkfieldentry.c trunk/gtk/src/ygtkfieldentry.h trunk/gtk/src/ygtkfixed.c trunk/gtk/src/ygtkfixed.h trunk/gtk/src/ygtkhtmlwrap.c trunk/gtk/src/ygtkhtmlwrap.h trunk/gtk/src/ygtkimage.c trunk/gtk/src/ygtkimage.h trunk/gtk/src/ygtklinklabel.c trunk/gtk/src/ygtklinklabel.h trunk/gtk/src/ygtkmenubutton.c trunk/gtk/src/ygtkmenubutton.h trunk/gtk/src/ygtkratiobox.c trunk/gtk/src/ygtkratiobox.h trunk/gtk/src/ygtkrichtext.c trunk/gtk/src/ygtksteps.c trunk/gtk/src/ygtksteps.h trunk/gtk/src/ygtktextview.h trunk/gtk/src/ygtktimezonepicker.c trunk/gtk/src/ygtktimezonepicker.h trunk/gtk/src/ygtktreeview.c trunk/gtk/src/ygtktreeview.h trunk/gtk/src/ygtkwizard.c trunk/gtk/src/ygtkwizard.h Modified: trunk/gtk/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/CMakeLists.txt?rev=64969&... ============================================================================== --- trunk/gtk/CMakeLists.txt (original) +++ trunk/gtk/CMakeLists.txt Sat Jul 23 07:43:30 2011 @@ -2,16 +2,16 @@ cmake_minimum_required (VERSION 2.4) project (yast2-gtk) - +SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ) ## configure -find_package (GTK2 REQUIRED gtk) +find_package (GTK3 REQUIRED gtk) find_package (Libyui REQUIRED) find_package (Zypp REQUIRED) -# debug while GTK2 support is shaky -message (STATUS "GTK2 includes:" ${GTK2_INCLUDE_DIRS}) -message (STATUS "GTK2 libraries:" ${GTK2_LIBRARIES}) +# ricardo: debug gtk cmake +message (STATUS "GTK3 includes:" ${GTK3_INCLUDE_DIRS}) +message (STATUS "GTK3 libraries:" ${GTK3_LIBRARIES}) # set libyui and libzypp versions execute_process (COMMAND pkg-config --modversion yast2-libyui COMMAND awk -F. "{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}" OUTPUT_VARIABLE YAST2_VERSION) Added: trunk/gtk/cmake/modules/FindGTK3.cmake URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/cmake/modules/FindGTK3.cmake?... ============================================================================== --- trunk/gtk/cmake/modules/FindGTK3.cmake (added) +++ trunk/gtk/cmake/modules/FindGTK3.cmake Sat Jul 23 07:43:30 2011 @@ -0,0 +1,47 @@ +# - Try to find GTK3 +# Once done this will define +# +# GTK3_FOUND - System has GTK3 +# GTK3_INCLUDE_DIR - The GTK3 include directory +# GTK3_LIBRARIES - The libraries needed to use GTK3 +# GTK3_DEFINITIONS - Compiler switches required for using GTK3 +#============================================================================= +# Copyright 2011 Duncan Mac-Vicar P. <duncan@kde.org> +# +# 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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(PC_GTK3 gtk+-3.0 QUIET) +SET(GTK3_DEFINITIONS ${PC_GTK3_CFLAGS_OTHER}) + +FIND_PATH(GTK3_INCLUDE_DIR NAMES "gtk/gtk.h" + HINTS + ${PC_GTK3_INCLUDEDIR} + ${PC_GTK3_INCLUDE_DIRS} + PATH_SUFFIXES "gtk-3.0" + ) +SET(GTK3_INCLUDE_DIRS ${PC_GTK3_INCLUDE_DIRS}) + +FIND_LIBRARY(GTK3_LIBRARIES NAMES gtk-3 gtk3 + HINTS + ${PC_GTK3_LIBDIR} + ${PC_GTK3_LIBRARY_DIRS} + ) + +# handle the QUIETLY and REQUIRED arguments and set GTK3_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_LIBRARIES GTK3_INCLUDE_DIR) + +MARK_AS_ADVANCED(GTK3_INCLUDE_DIR GTK3_LIBRARIES) + Modified: trunk/gtk/package/yast2-gtk.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/package/yast2-gtk.changes?rev... ============================================================================== --- trunk/gtk/package/yast2-gtk.changes (original) +++ trunk/gtk/package/yast2-gtk.changes Sat Jul 23 07:43:30 2011 @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Sat Jul 23 06:35:00 WET 2011 - rpmcruz@alunos.dcc.fc.up.pt + +- 2.22.0 +- ported to gtk3 +- don't show unsupported packages when the list is empty +(bnc#704103). +- showing mnemonics characters (bnc#704102). + +------------------------------------------------------------------- Sat Apr 16 13:51:00 WET 2011 - rpmcruz@alunos.dcc.fc.up.pt - 2.21.96 Modified: trunk/gtk/src/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/CMakeLists.txt?rev=64969&... ============================================================================== --- trunk/gtk/src/CMakeLists.txt (original) +++ trunk/gtk/src/CMakeLists.txt Sat Jul 23 07:43:30 2011 @@ -1,5 +1,9 @@ ## Makefile.am +add_definitions() + +include_directories(${GTK3_INCLUDE_DIRS}) + set (gtk_yast_plugin_SRCS YGBarGraph.cc YGComboBox.cc @@ -43,7 +47,7 @@ ## includes: include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -include_directories (${GTK2_INCLUDE_DIRS}) +include_directories (${GTK3_INCLUDE_DIRS}) include_directories (${LIBYUI_INCLUDE_DIR}) ## target: @@ -52,10 +56,10 @@ ## libraries: -target_link_libraries (py2gtk ${GTK2_LIBRARIES}) +target_link_libraries (py2gtk ${GTK3_LIBRARIES}) target_link_libraries (py2gtk ${LIBYUI_LIBRARY}) set_target_properties (py2gtk PROPERTIES SOVERSION 2) -set_target_properties (py2gtk PROPERTIES LINK_FLAGS "--no-undefined") +#set_target_properties (py2gtk PROPERTIES LINK_FLAGS "--no-undefined") ## install: @@ -69,6 +73,6 @@ add_executable (test test.cc) add_dependencies (test py2gtk) target_link_libraries (test libpy2gtk.so) -target_link_libraries (test ${GTK2_LIBRARIES}) +target_link_libraries (test ${GTK3_LIBRARIES}) target_link_libraries (test ${LIBYUI_LIBRARY}) Modified: trunk/gtk/src/YGBarGraph.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGBarGraph.cc?rev=64969&a... ============================================================================== --- trunk/gtk/src/YGBarGraph.cc (original) +++ trunk/gtk/src/YGBarGraph.cc Sat Jul 23 07:43:30 2011 @@ -26,19 +26,19 @@ const YBarGraphSegment &s = segment (i); ygtk_bar_graph_setup_entry (graph, i, s.label().c_str(), s.value()); if (s.hasSegmentColor()) { - GdkColor color = ycolorToGdk (s.segmentColor()); + GdkRGBA color = ycolorToGdk (s.segmentColor()); ygtk_bar_graph_customize_bg (graph, i, &color); } if (s.hasTextColor()) { - GdkColor color = ycolorToGdk (s.textColor()); + GdkRGBA color = ycolorToGdk (s.textColor()); ygtk_bar_graph_customize_fg (graph, i, &color); } } } - static GdkColor ycolorToGdk (const YColor &ycolor) + static GdkRGBA ycolorToGdk (const YColor &ycolor) { - GdkColor color = { 0, guint16(ycolor.red() << 8), guint16(ycolor.green() << 8), guint16(ycolor.blue() << 8) }; + GdkRGBA color = { 0, guint16(ycolor.red() << 8), guint16(ycolor.green() << 8), guint16(ycolor.blue() << 8) }; return color; } Modified: trunk/gtk/src/YGComboBox.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=64969&a... ============================================================================== --- trunk/gtk/src/YGComboBox.cc (original) +++ trunk/gtk/src/YGComboBox.cc Sat Jul 23 07:43:30 2011 @@ -16,7 +16,7 @@ YGComboBox (YWidget *parent, const string &label, bool editable) : YComboBox (NULL, label, editable), YGLabeledWidget (this, parent, label, YD_HORIZ, - editable ? GTK_TYPE_COMBO_BOX_ENTRY : GTK_TYPE_COMBO_BOX, NULL), + GTK_TYPE_COMBO_BOX, "has-entry", editable ? TRUE : FALSE, NULL), YGSelectionStore (false) { const GType types[2] = { GDK_TYPE_PIXBUF, G_TYPE_STRING }; @@ -29,7 +29,7 @@ "pixbuf", 0, NULL); if (editable) - gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (getWidget()), 1); + gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (getWidget()), 1); else { cell = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (getWidget()), cell, TRUE); @@ -87,16 +87,18 @@ virtual std::string text() { + GtkTreeIter iter; gchar *str; - if (GTK_IS_COMBO_BOX_ENTRY (getWidget())) - str = gtk_combo_box_get_active_text (getComboBox()); - else { - GtkTreeIter iter; - if (gtk_combo_box_get_active_iter (getComboBox(), &iter)) - gtk_tree_model_get (getModel(), &iter, 1, &str, -1); - else - return ""; + if (editable()) { + // HACK: this seems to be necessary + GtkWidget *entry = gtk_bin_get_child (GTK_BIN (getWidget())); + return gtk_entry_get_text (GTK_ENTRY (entry)); } + else + if (gtk_combo_box_get_active_iter (getComboBox(), &iter)) + gtk_tree_model_get (getModel(), &iter, 1, &str, -1); + else + return ""; std::string ret (str); g_free (str); return ret; Modified: trunk/gtk/src/YGDialog.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDialog.cc?rev=64969&... ============================================================================== --- trunk/gtk/src/YGDialog.cc (original) +++ trunk/gtk/src/YGDialog.cc Sat Jul 23 07:43:30 2011 @@ -52,6 +52,7 @@ m_widget = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_object_ref_sink (G_OBJECT (m_widget)); g_object_set (G_OBJECT (m_widget), "allow-shrink", TRUE, NULL); + gtk_window_set_has_resize_grip (GTK_WINDOW (m_widget), TRUE); m_refcount = 0; m_child = NULL; @@ -140,7 +141,7 @@ { setChild (NULL); if (m_busyCursor) - gdk_cursor_unref (m_busyCursor); + g_object_unref (G_OBJECT (m_busyCursor)); gtk_widget_destroy (m_widget); g_object_unref (G_OBJECT (m_widget)); } @@ -151,7 +152,7 @@ void normalCursor() { if (m_isBusy) - gdk_window_set_cursor (m_widget->window, NULL); + gdk_window_set_cursor (gtk_widget_get_window(m_widget), NULL); m_isBusy = false; } @@ -160,10 +161,10 @@ 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); + g_object_ref (G_OBJECT (m_busyCursor)); } if (!m_isBusy) - gdk_window_set_cursor (m_widget->window, m_busyCursor); + gdk_window_set_cursor (gtk_widget_get_window(m_widget), m_busyCursor); m_isBusy = true; } @@ -218,16 +219,16 @@ YGWindow *pThis) { // if not main dialog, close it on escape - if (event->keyval == GDK_Escape && + if (event->keyval == GDK_KEY_Escape && /* not main window */ main_window != pThis) { pThis->close(); return TRUE; - + } if (event->state & GDK_SHIFT_MASK) { switch (event->keyval) { - case GDK_F8: + case GDK_KEY_F8: YGUI::ui()->askSaveLogs(); return TRUE; default: @@ -238,35 +239,23 @@ && (event->state & GDK_MOD1_MASK)) { yuiMilestone() << "Caught YaST2 magic key combination\n"; switch (event->keyval) { - case GDK_S: + case GDK_KEY_S: YGUI::ui()->makeScreenShot(); return TRUE; - case GDK_M: + case GDK_KEY_M: YGUI::ui()->toggleRecordMacro(); return TRUE; - case GDK_P: + case GDK_KEY_P: YGUI::ui()->askPlayMacro(); return TRUE; - case GDK_D: + case GDK_KEY_D: YGUI::ui()->sendEvent (new YDebugEvent()); return TRUE; - case GDK_X: + case GDK_KEY_X: yuiMilestone() << "Starting xterm\n"; (void) system ("/usr/bin/xterm &"); return TRUE; - case GDK_H: - dumpYastHtml (pThis->getChild()); - return TRUE; - case GDK_E: // easter egg - static guint explode_timeout = 0; - if (explode_timeout == 0) - explode_timeout = g_timeout_add (10000, expode_window_timeout_cb, pThis); - else { - g_source_remove (explode_timeout); - explode_timeout = 0; - } - return TRUE; - case GDK_Y: + case GDK_KEY_Y: yuiMilestone() << "Opening dialog spy" << endl; YDialogSpy::showDialogSpy(); YGUI::ui()->normalCursor(); @@ -283,36 +272,6 @@ static void realize_cb (GtkWidget *widget, YGWindow *pThis) { pThis->busyCursor(); } - - static gboolean expode_window_timeout_cb (gpointer data) - { - YGWindow *pThis = (YGWindow *) data; - GtkWindow *window = GTK_WINDOW (pThis->m_widget); - srand (time (NULL)); - gint x, y; - gtk_window_get_position (window, &x, &y); - #if 0 - // OVAL MOVE - for (int i = 180; i < 360+180; i++) { - gtk_window_move (window, x+(int)(sin((i*G_PI)/180)*50), - y+(int)(cos((i*G_PI)/180)*50)+50); - while (gtk_events_pending()) - gtk_main_iteration(); - usleep (25); - } - #else - // EXPLOSION - for (int i = 0; i < 40; i++) { - gtk_window_move (window, x+(int)((((float)(rand())/RAND_MAX)*40)-20), - y+(int)((((float)(rand())/RAND_MAX)*40)-20)); - while (gtk_events_pending()) - gtk_main_iteration(); - usleep (200); - } - #endif - gtk_window_move (window, x, y); - return TRUE; - } }; YGDialog::YGDialog (YDialogType dialogType, YDialogColorMode colorMode) @@ -416,17 +375,19 @@ // libyui calls YDialog::setSize() to force a geometry recalculation as a // result of changed layout properties GtkWidget *window = m_window->getWidget(); - if (GTK_WIDGET_REALIZED (window)) { + if (gtk_widget_get_realized (window)) { gtk_widget_queue_resize (window); width = MIN (width, YUI::app()->displayWidth()); height = MIN (height, YUI::app()->displayHeight()); #if 1 bool resize = false; if (isMainDialog()) { - if (window->allocation.width < width || window->allocation.height < height) { + GtkAllocation allocation; + gtk_widget_get_allocation(window, &allocation); + if (allocation.width < width || allocation.height < height) { resize = true; - width = MAX (width, window->allocation.width), - height = MAX (height, window->allocation.height); + width = MAX (width, allocation.width), + height = MAX (height, allocation.height); } } else @@ -442,26 +403,23 @@ void YGDialog::highlight (YWidget *ywidget) { struct inner { - static gboolean expose_highlight_cb (GtkWidget *widget, - GdkEventExpose *event) + static gboolean draw_highlight_cb (GtkWidget *widget, cairo_t *cr) { - GtkAllocation *alloc = &widget->allocation; - int x = alloc->x, y = alloc->y, w = alloc->width, h = alloc->height; + int w = gtk_widget_get_allocated_width(widget); + int h = gtk_widget_get_allocated_height(widget); - cairo_t *cr = gdk_cairo_create (widget->window); - cairo_rectangle (cr, x, y, w, h); + cairo_rectangle (cr, 0, 0, w, h); cairo_set_source_rgb (cr, 0xff/255.0, 0x88/255.0, 0); cairo_fill (cr); - cairo_destroy (cr); return FALSE; } static bool hasWindow (GtkWidget *widget) { - if (!GTK_WIDGET_NO_WINDOW (widget)) + if (gtk_widget_get_has_window(widget)) return true; // widgets like GtkButton add their windows to parent's - for (GList *children = gdk_window_peek_children (widget->window); + for (GList *children = gdk_window_peek_children (gtk_widget_get_window(widget)); children; children = children->next) { GdkWindow *child = (GdkWindow *) children->data; gpointer data; @@ -479,12 +437,12 @@ if (prev) { GtkWidget *widget = prev->getWidget(); if (inner::hasWindow (widget)) { - gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, NULL); - gtk_widget_modify_base (widget, GTK_STATE_NORMAL, NULL); + gtk_widget_override_background_color (widget, GTK_STATE_FLAG_NORMAL, NULL); + gtk_widget_override_color (widget, GTK_STATE_FLAG_NORMAL, NULL); } else { g_signal_handlers_disconnect_by_func (widget, - (gpointer) inner::expose_highlight_cb, NULL); + (gpointer) inner::draw_highlight_cb, NULL); gtk_widget_queue_draw (widget); } } @@ -494,14 +452,14 @@ if (ygwidget) { GtkWidget *widget = ygwidget->getWidget(); if (inner::hasWindow (widget)) { - GdkColor bg_color = { 0, 0xffff, 0xaaaa, 0 }; - GdkColor base_color = { 0, 0xffff, 0xeeee, 0 }; - gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &bg_color); - gtk_widget_modify_base (widget, GTK_STATE_NORMAL, &base_color); + GdkRGBA bg_color = { 0, 0xffff, 0xaaaa, 0 }; + GdkRGBA base_color = { 0, 0xffff, 0xeeee, 0 }; + gtk_widget_override_background_color (widget, GTK_STATE_FLAG_NORMAL, &bg_color); + gtk_widget_override_color (widget, GTK_STATE_FLAG_NORMAL, &base_color); } else { - g_signal_connect (G_OBJECT (widget), "expose-event", - G_CALLBACK (inner::expose_highlight_cb), NULL); + g_signal_connect (G_OBJECT (widget), "draw", + G_CALLBACK (inner::draw_highlight_cb), NULL); gtk_widget_queue_draw (widget); } } Modified: trunk/gtk/src/YGDumbTab.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGDumbTab.cc?rev=64969&am... ============================================================================== --- trunk/gtk/src/YGDumbTab.cc (original) +++ trunk/gtk/src/YGDumbTab.cc Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #include "YGWidget.h" #include "YGUtils.h" #include "YDumbTab.h" - +#include <gtk/gtk.h> #include "ygtkratiobox.h" class YGDumbTab : public YDumbTab, public YGWidget @@ -141,7 +141,7 @@ } // callbacks - static void switch_page_cb (GtkNotebook *notebook, GtkNotebookPage *page, + static void switch_page_cb (GtkNotebook *notebook, GtkWidget *page, guint tab_nb, YGDumbTab *pThis) { GtkWidget *child = gtk_notebook_get_nth_page (notebook, tab_nb); Modified: trunk/gtk/src/YGFrame.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGFrame.cc?rev=64969&... ============================================================================== --- trunk/gtk/src/YGFrame.cc (original) +++ trunk/gtk/src/YGFrame.cc Sat Jul 23 07:43:30 2011 @@ -39,10 +39,10 @@ static GtkWidget *findFirstFocusable (GtkContainer *container) { g_return_val_if_fail (container != NULL, NULL); - + for (GList *l = gtk_container_get_children (container); l; l = l->next) { - if (GTK_WIDGET_CAN_FOCUS (l->data)) + if (gtk_widget_get_can_focus (GTK_WIDGET(l->data))) return GTK_WIDGET (l->data); else if (GTK_IS_CONTAINER (l->data)) { GtkWidget *ret = findFirstFocusable (GTK_CONTAINER (l->data)); @@ -130,7 +130,7 @@ virtual void setLabel (const string &_str) { GtkWidget *button = gtk_frame_get_label_widget (GTK_FRAME (getWidget())); - GtkLabel *label = GTK_LABEL (GTK_BIN (button)->child); + GtkLabel *label = GTK_LABEL (gtk_bin_get_child(GTK_BIN (button))); string str (YGUtils::mapKBAccel (_str)); gtk_label_set_text_with_mnemonic (label, str.c_str()); Modified: trunk/gtk/src/YGImage.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGImage.cc?rev=64969&... ============================================================================== --- trunk/gtk/src/YGImage.cc (original) +++ trunk/gtk/src/YGImage.cc Sat Jul 23 07:43:30 2011 @@ -35,8 +35,12 @@ stock = GTK_STOCK_DIALOG_WARNING; else if (endsWith (filename, "/msg_error.png")) stock = GTK_STOCK_DIALOG_ERROR; - if (stock && gtk_style_lookup_icon_set (m_widget->style, stock)) { - GdkPixbuf *pixbuf = gtk_widget_render_icon (m_widget, stock, GTK_ICON_SIZE_DIALOG, NULL); + + GtkStyleContext *ctx; + ctx = gtk_widget_get_style_context(m_widget); + + if (stock && gtk_style_context_lookup_icon_set (ctx, stock)) { + GdkPixbuf *pixbuf = gtk_widget_render_icon_pixbuf (m_widget, stock, GTK_ICON_SIZE_DIALOG); ygtk_image_set_from_pixbuf (image, pixbuf); } else Modified: trunk/gtk/src/YGLayout.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGLayout.cc?rev=64969&... ============================================================================== --- trunk/gtk/src/YGLayout.cc (original) +++ trunk/gtk/src/YGLayout.cc Sat Jul 23 07:43:30 2011 @@ -21,16 +21,17 @@ } #define YGLAYOUT_INIT \ - ygtk_fixed_setup (YGTK_FIXED (getWidget()), preferred_size_cb, set_size_cb, this); + ygtk_fixed_setup (YGTK_FIXED (getWidget()), preferred_width_cb, preferred_height_cb, set_size_cb, this); #define YGLAYOUT_PREFERRED_SIZE_IMPL(ParentClass) \ - static void preferred_size_cb (YGtkFixed *fixed, gint *width, gint *height, \ - gpointer pThis) { \ - *width = ((ParentClass *) pThis)->ParentClass::preferredWidth(); \ - *height = ((ParentClass *) pThis)->ParentClass::preferredHeight(); \ + static gint preferred_width_cb (YGtkFixed *fixed, gpointer pThis) { \ + return ((ParentClass *) pThis)->ParentClass::preferredWidth(); \ + } \ + static gint preferred_height_cb (YGtkFixed *fixed, gpointer pThis) { \ + return ((ParentClass *) pThis)->ParentClass::preferredHeight(); \ } -#define YGLAYOUT_SET_SIZE_IMPL(ParentClass) \ +#define YGLAYOUT_SET_SIZE_IMPL(ParentClass) \ static void set_size_cb (YGtkFixed *fixed, gint width, gint height, \ - gpointer pThis) { \ + gpointer pThis) { \ ((ParentClass *) pThis)->ParentClass::setSize (width, height); \ } \ virtual void moveChild (YWidget *ychild, int x, int y) \ @@ -161,7 +162,7 @@ if (filename.empty()) { m_background_pixbuf = 0; g_signal_handlers_disconnect_by_func (G_OBJECT (getWidget()), - (void*) expose_event_cb, this); + (void*) draw_event_cb, this); } else { GError *error = 0; @@ -170,27 +171,22 @@ g_warning ("Setting YAlignment background - couldn't load image '%s' - %s", filename.c_str(), error->message); else - g_signal_connect (G_OBJECT (getWidget()), "expose-event", - G_CALLBACK (expose_event_cb), this); + g_signal_connect (G_OBJECT (getWidget()), "draw", + G_CALLBACK (draw_event_cb), this); } } - static gboolean expose_event_cb (GtkWidget *widget, GdkEventExpose *event, - YGAlignment *pThis) + static gboolean draw_event_cb (GtkWidget *widget, cairo_t *cr, int width, int height, + YGAlignment *pThis) { - GtkAllocation *alloc = &widget->allocation; - cairo_t *cr = gdk_cairo_create (widget->window); - gdk_cairo_set_source_pixbuf (cr, pThis->m_background_pixbuf, 0, 0); cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT); - cairo_rectangle (cr, alloc->x, alloc->y, alloc->width, alloc->height); + cairo_rectangle (cr, 0, 0, width, height); cairo_fill (cr); - cairo_destroy (cr); - - gtk_container_propagate_expose (GTK_CONTAINER (widget), - GTK_BIN (widget)->child, event); + gtk_container_propagate_draw (GTK_CONTAINER (widget), + gtk_bin_get_child(GTK_BIN (widget)), cr); return TRUE; } }; @@ -234,7 +230,7 @@ YGWIDGET_IMPL_COMMON (YSpacing) YGLAYOUT_PREFERRED_SIZE_IMPL (YSpacing) - static void set_size_cb (YGtkFixed *fixed, gint width, gint height, + static void set_size_cb (YGtkFixed *fixed, gint width, gint height, gpointer pThis) {} }; Modified: trunk/gtk/src/YGProgressBar.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGProgressBar.cc?rev=6496... ============================================================================== --- trunk/gtk/src/YGProgressBar.cc (original) +++ trunk/gtk/src/YGProgressBar.cc Sat Jul 23 07:43:30 2011 @@ -137,8 +137,8 @@ ygtk_ratio_box_set_spacing (YGTK_RATIO_BOX (getWidget()), 2); for (int s = 0; s < segments(); s++) { GtkWidget *bar = gtk_progress_bar_new(); - gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (bar), - horizontal() ? GTK_PROGRESS_LEFT_TO_RIGHT : GTK_PROGRESS_BOTTOM_TO_TOP); + gtk_orientable_set_orientation(GTK_ORIENTABLE(bar), horizontal() ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); + gtk_progress_bar_set_inverted(GTK_PROGRESS_BAR (bar), horizontal() ? FALSE : TRUE); // Progress bars would ask for too much size with weight... const int min_size = 5; if (horizontal()) Modified: trunk/gtk/src/YGPushButton.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPushButton.cc?rev=64969... ============================================================================== --- trunk/gtk/src/YGPushButton.cc (original) +++ trunk/gtk/src/YGPushButton.cc Sat Jul 23 07:43:30 2011 @@ -11,6 +11,7 @@ #include <string.h> #include <YLayoutBox.h> +#include "ygtkratiobox.h" class YGPushButton : public YPushButton, public YGWidget { @@ -25,7 +26,7 @@ gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE); setLabel (label); connect (getWidget(), "clicked", G_CALLBACK (clicked_cb), this); - g_signal_connect (getWidget(), "size-request", G_CALLBACK (size_request_cb), this); + g_signal_connect (getWidget(), "realize", G_CALLBACK (realize_cb), this); } void setStockIcon (const std::string &label) @@ -135,8 +136,8 @@ YPushButton::setDefaultButton (isDefault); if (isDefault) { GtkWidget *button = getWidget(); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); - if (GTK_WIDGET_REALIZED (button)) + gtk_widget_set_can_default(button, TRUE); + if (gtk_widget_get_realized (button)) inner::realize_cb (button); g_signal_connect (G_OBJECT (button), "realize", G_CALLBACK (inner::realize_cb), this); @@ -148,7 +149,7 @@ if (dynamic_cast <YPushButton *> (ywidget)) { GtkWidget *button = YGWidget::get (ywidget)->getWidget(); GtkWidget *icon = gtk_button_get_image (GTK_BUTTON (button)); - return icon && GTK_WIDGET_VISIBLE (icon); + return icon && gtk_widget_get_visible (icon); } return true; } @@ -165,7 +166,7 @@ for (YWidgetListConstIterator it = ybox->childrenBegin(); it != ybox->childrenEnd(); it++) { if ((YWidget *) pThis == *it) { - if (ylast && !hasIcon (ylast)) + if (ylast && !hasIcon (ylast)) pThis->setIcon (""); break; } @@ -205,13 +206,11 @@ #define DEFAULT_CHILD_MIN_WIDTH 85 #define DEFAULT_CHILD_MIN_HEIGHT 27 - static void size_request_cb (GtkWidget *widget, GtkRequisition *req, YGPushButton *pThis) + static void realize_cb (GtkWidget *widget, YGPushButton *pThis) { // enlarge button if parent is ButtonBox YWidget *yparent = pThis->m_ywidget->parent(); - if (yparent && !strcmp (yparent->widgetClass(), "YButtonBox")) { - req->width = MAX (req->width, DEFAULT_CHILD_MIN_WIDTH); - req->height = MAX (req->height, DEFAULT_CHILD_MIN_HEIGHT); - } + if (yparent && !strcmp (yparent->widgetClass(), "YButtonBox")) + ygtk_adj_size_set_min (YGTK_ADJ_SIZE(pThis->getLayout()), DEFAULT_CHILD_MIN_WIDTH, DEFAULT_CHILD_MIN_HEIGHT); } YGWIDGET_IMPL_COMMON (YPushButton) Modified: trunk/gtk/src/YGSelectionStore.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionStore.h?rev=64... ============================================================================== --- trunk/gtk/src/YGSelectionStore.h (original) +++ trunk/gtk/src/YGSelectionStore.h Sat Jul 23 07:43:30 2011 @@ -7,7 +7,7 @@ #ifndef YGSELECTION_STORE_H #define YGSELECTION_STORE_H -#include <gtk/gtktreemodel.h> +#include <gtk/gtk.h> struct YItem; struct YSelectionWidget; Modified: trunk/gtk/src/YGText.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGText.cc?rev=64969&r... ============================================================================== --- trunk/gtk/src/YGText.cc (original) +++ trunk/gtk/src/YGText.cc Sat Jul 23 07:43:30 2011 @@ -74,7 +74,7 @@ void scrollToBottom() { #if 1 - YGUtils::scrollWidget (GTK_TEXT_VIEW (getWidget())->vadjustment, false); + YGUtils::scrollWidget (gtk_scrollable_get_vadjustment(GTK_SCROLLABLE (getWidget())), false); #else GtkTextBuffer *buffer = getBuffer(); GtkTextIter iter; @@ -167,8 +167,8 @@ if (text.size() == m_text.size()) return; // appending text: avoid flickering and allow user to scroll freely - GtkAdjustment *vadj = GTK_TEXT_VIEW (getWidget())->vadjustment; - bool autoScroll = vadj->value >= vadj->upper - vadj->page_size; + GtkAdjustment *vadj = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE (getWidget())); + bool autoScroll = gtk_adjustment_get_value(vadj) >= gtk_adjustment_get_upper(vadj) - gtk_adjustment_get_page_size(vadj); std::string diff (text.substr (m_text.size())); YGTextView::appendText (diff); Modified: trunk/gtk/src/YGTreeView.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGTreeView.cc?rev=64969&a... ============================================================================== --- trunk/gtk/src/YGTreeView.cc (original) +++ trunk/gtk/src/YGTreeView.cc Sat Jul 23 07:43:30 2011 @@ -378,7 +378,7 @@ void setSortable (bool sortable) { - if (!sortable && !GTK_WIDGET_REALIZED (getWidget())) + if (!sortable && !gtk_widget_get_realized (getWidget())) return; int n = 0; GList *columns = gtk_tree_view_get_columns (getView()); @@ -514,7 +514,7 @@ static gboolean key_press_event_cb (GtkWidget *widget, GdkEventKey *event, YGTable *pThis) { - if (event->keyval == GDK_Delete) { + if (event->keyval == GDK_KEY_Delete) { YWidget *button = YGDialog::currentDialog()->getFunctionWidget (5); if (button) activateButton (button); Modified: trunk/gtk/src/YGUI.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.cc?rev=64969&r1=... ============================================================================== --- trunk/gtk/src/YGUI.cc (original) +++ trunk/gtk/src/YGUI.cc Sat Jul 23 07:43:30 2011 @@ -356,11 +356,14 @@ return; } + GtkAllocation alloc; + gtk_widget_get_allocation(widget, &alloc); + GError *error = 0; GdkPixbuf *shot = - gdk_pixbuf_get_from_drawable (NULL, GDK_DRAWABLE (widget->window), - gdk_colormap_get_system(), 0, 0, 0, 0, widget->allocation.width, - widget->allocation.height); + gdk_pixbuf_get_from_window (gtk_widget_get_window(widget), + 0, 0, alloc.width, + alloc.height); if (!shot) { if (interactive) @@ -601,52 +604,3 @@ YApplication *YGUI::createApplication() { return new YGApplication(); } -#include <YRichText.h> -#include "ygtktextview.h" - -void dumpYastHtml (YWidget *widget) -{ - struct inner { - static void dumpYastHtml (YWidget *widget, GtkBox *box) - { - YGWidget *ygwidget; - if (!widget || !(ygwidget = YGWidget::get (widget))) - return; - - YRichText *rtext = dynamic_cast <YRichText *> (widget); - if (rtext) { - std::string text = rtext->text(); - - GtkWidget *view = ygtk_text_view_new (FALSE); - gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD); - GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); - gtk_text_buffer_set_text (buffer, text.c_str(), -1); - - GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), - GTK_SHADOW_IN); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (scroll), view); - gtk_box_pack_start (box, scroll, TRUE, TRUE, 6); - } - - for (YWidgetListConstIterator it = widget->childrenBegin(); - it != widget->childrenEnd(); it++) - dumpYastHtml (*it, box); - } - static void destroy_dialog (GtkDialog *dialog, gint arg) - { gtk_widget_destroy (GTK_WIDGET (dialog)); } - }; - - 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); - - inner::dumpYastHtml (widget, GTK_BOX (GTK_DIALOG (dialog)->vbox)); - - gtk_widget_show_all (dialog); - g_signal_connect (G_OBJECT (dialog), "response", - G_CALLBACK (inner::destroy_dialog), 0); -} - Modified: trunk/gtk/src/YGUI.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUI.h?rev=64969&r1=6... ============================================================================== --- trunk/gtk/src/YGUI.h (original) +++ trunk/gtk/src/YGUI.h Sat Jul 23 07:43:30 2011 @@ -72,10 +72,6 @@ bool isSwsingle() const { return m_swsingle; } }; -// debug helpers. -void dumpTree (YWidget *widget); -void dumpYastHtml (YWidget *widget); - #include <YWidgetFactory.h> class YGWidgetFactory : public YWidgetFactory Modified: trunk/gtk/src/YGUtils.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=64969&... ============================================================================== --- trunk/gtk/src/YGUtils.cc (original) +++ trunk/gtk/src/YGUtils.cc Sat Jul 23 07:43:30 2011 @@ -411,14 +411,14 @@ static gboolean scroll_down_cb (void *pData) { GtkAdjustment *vadj = (GtkAdjustment *) pData; - gtk_adjustment_set_value (vadj, vadj->upper - vadj->page_size); + gtk_adjustment_set_value (vadj, gtk_adjustment_get_upper(vadj) - gtk_adjustment_get_page_size(vadj)); return FALSE; } void YGUtils::scrollWidget (GtkAdjustment *vadj, bool top) { if (top) - gtk_adjustment_set_value (vadj, vadj->lower); + gtk_adjustment_set_value (vadj, gtk_adjustment_get_lower(vadj)); else // since we usually want to call this together with a text change, we // must wait till that gets in effect @@ -460,9 +460,10 @@ int YGUtils::getCharsWidth (GtkWidget *widget, int chars_nb) { + GtkStyleContext *style_ctx = gtk_widget_get_style_context(widget); PangoContext *context = gtk_widget_get_pango_context (widget); PangoFontMetrics *metrics = pango_context_get_metrics (context, - widget->style->font_desc, NULL); + gtk_style_context_get_font(style_ctx, GTK_STATE_FLAG_NORMAL), NULL); int width = pango_font_metrics_get_approximate_char_width (metrics); pango_font_metrics_unref (metrics); @@ -472,9 +473,10 @@ int YGUtils::getCharsHeight (GtkWidget *widget, int chars_nb) { + GtkStyleContext *style_ctx = gtk_widget_get_style_context(widget); PangoContext *context = gtk_widget_get_pango_context (widget); PangoFontMetrics *metrics = pango_context_get_metrics (context, - widget->style->font_desc, NULL); + gtk_style_context_get_font(style_ctx, GTK_STATE_FLAG_NORMAL), NULL); int height = pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics); @@ -486,13 +488,15 @@ void YGUtils::setWidgetFont (GtkWidget *widget, PangoStyle style, PangoWeight weight, double scale) { - PangoFontDescription *font_desc = widget->style->font_desc; + GtkStyleContext *style_ctx = gtk_widget_get_style_context(widget); + const PangoFontDescription *font_desc = gtk_style_context_get_font(style_ctx, GTK_STATE_FLAG_NORMAL); + int size = pango_font_description_get_size (font_desc); PangoFontDescription* font = pango_font_description_new(); pango_font_description_set_weight (font, weight); pango_font_description_set_size (font, (int)(size * scale)); pango_font_description_set_style (font, style); - gtk_widget_modify_font (widget, font); + gtk_widget_override_font (widget, font); pango_font_description_free (font); } @@ -504,10 +508,13 @@ if (!g_object_get_data (G_OBJECT (paned), "init")) { // only once gdouble rel = GPOINTER_TO_INT (_rel) / 100.; gint parent_size; + GtkAllocation alloc; + gtk_widget_get_allocation(paned, &alloc); + if (gtk_orientable_get_orientation (GTK_ORIENTABLE (paned)) == GTK_ORIENTATION_HORIZONTAL) - parent_size = paned->allocation.width; + parent_size = alloc.width; else - parent_size = paned->allocation.height; + parent_size = alloc.height; int pos = parent_size * rel; gtk_paned_set_position (GTK_PANED (paned), pos); g_object_set_data (G_OBJECT (paned), "init", GINT_TO_POINTER (1)); @@ -711,10 +718,12 @@ const char *fallbackIcon) { const char *icon = mapStockIcon (label); + GtkStyleContext *ctx = gtk_widget_get_style_context(button); + if (!icon && label.size() < 22) icon = fallbackIcon; if (icon) { - if (gtk_style_lookup_icon_set (button->style, icon)) { + if (gtk_style_context_lookup_icon_set (ctx, 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); @@ -731,19 +740,26 @@ void YGUtils::shrinkWidget (GtkWidget *widget) { static bool first_time = true; + GtkCssProvider *provider; + if (first_time) { - first_time = false; - gtk_rc_parse_string ( - "style "small-widget-style"\n" + provider = gtk_css_provider_new (); + gtk_css_provider_load_from_data (provider, + "style "small-widget-style"\n" "{\n" " GtkWidget::focus-padding = 0\n" " GtkWidget::focus-line-width = 0\n" " xthickness = 0\n" " ythickness = 0\n" "}\n" - "widget "*.small-widget" style "small-widget-style""); - } - gtk_widget_set_name (widget, "small-widget"); + "widget "*.small-widget" style "small-widget-style"", -1, NULL); + gtk_style_context_add_provider (gtk_widget_get_style_context (widget), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_object_unref (provider); + gtk_widget_set_name (widget, "small-widget"); + first_time = false; + } } /* @@ -764,7 +780,7 @@ for (; text[i]; i++) if (text[i] == '>') break; - + if (!strncasecmp (text+a, "<h", 2) || !strncasecmp (text+a, "<big>", 5) || (!str->len && !strncasecmp (text+a, "<b>", 3))) { for (i++; text[i]; i++) { Modified: trunk/gtk/src/YGUtils.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.h?rev=64969&r... ============================================================================== --- trunk/gtk/src/YGUtils.h (original) +++ trunk/gtk/src/YGUtils.h Sat Jul 23 07:43:30 2011 @@ -7,8 +7,7 @@ #include <string> #include <list> -#include <gtk/gtktextview.h> -#include <gtk/gtkentry.h> +#include <gtk/gtk.h> /* YGUtils.h/cc have some functionality that is shared between different parts of the code. */ Modified: trunk/gtk/src/YGWidget.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGWidget.cc?rev=64969&... ============================================================================== --- trunk/gtk/src/YGWidget.cc (original) +++ trunk/gtk/src/YGWidget.cc Sat Jul 23 07:43:30 2011 @@ -54,7 +54,7 @@ static void min_size_cb (guint *min_width, guint *min_height, gpointer pData); YGWidget::YGWidget(YWidget *ywidget, YWidget *yparent, - GtkType type, const char *property_name, ...) + GType type, const char *property_name, ...) : m_ywidget (ywidget) { va_list args; @@ -157,7 +157,7 @@ { // We might want to do some caching here.. GtkRequisition req; - gtk_widget_size_request (m_adj_size, &req); + gtk_widget_get_preferred_size (m_adj_size, &req, NULL); return dimension == YD_HORIZ ? req.width : req.height; } Modified: trunk/gtk/src/pkg/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/CMakeLists.txt?rev=64... ============================================================================== --- trunk/gtk/src/pkg/CMakeLists.txt (original) +++ trunk/gtk/src/pkg/CMakeLists.txt Sat Jul 23 07:43:30 2011 @@ -43,11 +43,12 @@ ## libraries: target_link_libraries (py2gtk_pkg libpy2gtk.so) -target_link_libraries (py2gtk_pkg ${GTK2_LIBRARIES}) +target_link_libraries (py2gtk_pkg ${GTK3_LIBRARIES}) target_link_libraries (py2gtk_pkg ${LIBYUI_LIBRARY}) target_link_libraries (py2gtk_pkg ${ZYPP_LIBRARY}) set_target_properties (py2gtk_pkg PROPERTIES SOVERSION 2) -set_target_properties (py2gtk_pkg PROPERTIES LINK_FLAGS "--no-undefined -Wl,-rpath -Wl,${UI_PLUGIN_DIR}") +#set_target_properties (py2gtk_pkg PROPERTIES LINK_FLAGS "--no-undefined -Wl,-rpath -Wl,${UI_PLUGIN_DIR}") +set_target_properties (py2gtk_pkg PROPERTIES LINK_FLAGS "-Wl,-rpath -Wl,${UI_PLUGIN_DIR}") ## install: Modified: trunk/gtk/src/pkg/YGPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc?... ============================================================================== --- trunk/gtk/src/pkg/YGPackageSelector.cc (original) +++ trunk/gtk/src/pkg/YGPackageSelector.cc Sat Jul 23 07:43:30 2011 @@ -258,7 +258,7 @@ (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER (scroll), view); - GtkBox *vbox = GTK_BOX (GTK_DIALOG(dialog)->vbox); + GtkBox *vbox = GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG(dialog))); gtk_box_pack_start (vbox, scroll, TRUE, TRUE, 6); gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); @@ -411,7 +411,7 @@ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN); gtk_container_add (GTK_CONTAINER (scroll), view); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scroll); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), scroll); gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); gtk_window_set_default_size (GTK_WINDOW (dialog), -1, 500); @@ -603,6 +603,13 @@ { return Ypp::Package (sel).support() <= 1; } }; + Ypp::PoolQuery query (Ypp::Selectable::PACKAGE); + query.addCriteria (new Ypp::StatusMatch (Ypp::StatusMatch::TO_MODIFY)); + query.addCriteria (new UnsupportedMatch()); + Ypp::List list (query); + if(list.size() == 0) + return true; + GtkWidget *dialog = gtk_message_dialog_new (YGDialog::currentWindow(), GtkDialogFlags (0), GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, _("Unsupported packages")); @@ -615,11 +622,6 @@ gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 500); - Ypp::PoolQuery query (Ypp::Selectable::PACKAGE); - query.addCriteria (new Ypp::StatusMatch (Ypp::StatusMatch::TO_MODIFY)); - query.addCriteria (new UnsupportedMatch()); - Ypp::List list (query); - YGtkPkgListView view (true, Ypp::List::NAME_SORT, false, true); view.addCheckColumn (INSTALLED_CHECK_PROP); view.addTextColumn (_("Name"), NAME_SUMMARY_PROP, true, -1); @@ -629,7 +631,7 @@ view.setListener (this); view.setList (list); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), view.getWidget()); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), view.getWidget()); gtk_widget_show_all (dialog); int ret = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); Modified: trunk/gtk/src/pkg/ygtkcellrendererbutton.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrendererbutto... ============================================================================== --- trunk/gtk/src/pkg/ygtkcellrendererbutton.c (original) +++ trunk/gtk/src/pkg/ygtkcellrendererbutton.c Sat Jul 23 07:43:30 2011 @@ -31,9 +31,7 @@ { bcell->active = FALSE; GtkCellRenderer *cell = GTK_CELL_RENDERER (bcell); - cell->xpad = BORDER; - cell->ypad = BORDER; - cell->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE; + g_object_set(cell, "xpad", BORDER, "ypad", BORDER, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL); bcell->icon_size = 16; } @@ -118,14 +116,19 @@ static PangoLayout *create_layout (YGtkCellRendererButton *bcell, GtkWidget *widget) { GtkCellRendererText *tcell = GTK_CELL_RENDERER_TEXT (bcell); - if (tcell->text) - return gtk_widget_create_pango_layout (widget, tcell->text); - return NULL; + gchar *text = NULL; + g_object_get (G_OBJECT (tcell), "text", &text, NULL); + PangoLayout *layout = NULL; + if (text) { + layout = gtk_widget_create_pango_layout (widget, text); + g_free(text); + } + return layout; } static void ensure_pixbuf (YGtkCellRendererButton *cell, GtkWidget *widget) { - if ((cell->icon_name || cell->stock_id) && !cell->pixbuf) { + if (!cell->pixbuf && (cell->icon_name || cell->stock_id)) { if (cell->icon_name) { GtkIconTheme *theme = gtk_icon_theme_get_default(); GError *error = 0; @@ -136,13 +139,13 @@ cell->icon_name, error->message); } else // stock-id - cell->pixbuf = gtk_widget_render_icon (widget, cell->stock_id, - GTK_ICON_SIZE_BUTTON, "button"); + cell->pixbuf = gtk_widget_render_icon_pixbuf ( + widget, cell->stock_id, GTK_ICON_SIZE_BUTTON); } } static void ygtk_cell_renderer_button_get_size_full (GtkCellRenderer *cell, - GtkWidget *widget, GdkRectangle *cell_area, gint *_xoffset, gint *_yoffset, + GtkWidget *widget, const 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) { @@ -170,28 +173,35 @@ width += PIXBUF_TEXT_SPACING; height = MAX (pixbuf_height, text_height); + gfloat xalign, yalign; + guint xpad, ypad; + g_object_get(cell, + "xalign", &xalign, + "yalign", &yalign, + "xpad", &xpad, + "ypad", &ypad, NULL); + 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; + int cell_width = cell_area->width - xpad*2, + cell_height = cell_area->height - ypad*2; + int xoffset = (xalign * (cell_width - width)) + xpad; + int yoffset = (yalign * (cell_height - height)) + 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; + text_y = (yalign * (cell_height - text_height)) + 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; + pixbuf_y = (yalign * (cell_height - pixbuf_height)) + ypad; if (_pixbuf_xoffset) *_pixbuf_xoffset = pixbuf_x; if (_pixbuf_yoffset) *_pixbuf_yoffset = pixbuf_y; @@ -201,39 +211,37 @@ if (_text_yoffset) *_text_yoffset = text_y; } - if (_width) *_width = width + (cell->xpad * 2); - if (_height) *_height = height + (cell->ypad * 2); + if (_width) *_width = width + (xpad * 2); + if (_height) *_height = height + (ypad * 2); } static void ygtk_cell_renderer_button_get_size (GtkCellRenderer *cell, - GtkWidget *widget, GdkRectangle *cell_area, gint *xoffset, gint *yoffset, + GtkWidget *widget, const GdkRectangle *cell_area, gint *xoffset, gint *yoffset, gint *width, gint *height) { ygtk_cell_renderer_button_get_size_full (cell, widget, cell_area, xoffset, yoffset, width, height, NULL, NULL, NULL, NULL, NULL, NULL); } -static void ygtk_cell_renderer_button_render (GtkCellRenderer *cell, - GdkDrawable *window, GtkWidget *widget, GdkRectangle *background_area, - GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags) +static void ygtk_cell_renderer_button_render( + GtkCellRenderer *cell, cairo_t *cr, GtkWidget *widget, + const GdkRectangle *background_area, const GdkRectangle *cell_area, + GtkCellRendererState flags) { YGtkCellRendererButton *bcell = YGTK_CELL_RENDERER_BUTTON (cell); - gboolean has_focus = FALSE; - if (flags & GTK_CELL_RENDERER_SELECTED) - has_focus = GTK_WIDGET_HAS_FOCUS (widget); - GtkStateType state = GTK_STATE_NORMAL; - if (!cell->sensitive || GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE) + if (!gtk_cell_renderer_get_sensitive(cell) || gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) state = GTK_STATE_INSENSITIVE; else if ((flags & GTK_CELL_RENDERER_PRELIT)) state = GTK_STATE_PRELIGHT; - - GtkShadowType shadow = GTK_SHADOW_OUT; - if (bcell->active) { - shadow = GTK_SHADOW_IN; + if (bcell->active) state = GTK_STATE_ACTIVE; - } + + GtkStyleContext *style = gtk_widget_get_style_context(widget); + gtk_style_context_save(style); + gtk_style_context_set_state(style, state); + gtk_style_context_add_class (style, GTK_STYLE_CLASS_BUTTON); int text_xoffset, text_yoffset, pixbuf_xoffset, pixbuf_yoffset, pixbuf_width, pixbuf_height, width, height; @@ -245,41 +253,39 @@ int y = cell_area->y + (cell_area->height - height)/2 + OUTER_BORDER; width -= OUTER_BORDER*2; height -= OUTER_BORDER*2; - gtk_paint_box (widget->style, window, state, shadow, expose_area, widget, - "button", x, y, width, height); + gtk_render_background (style, cr, x, y, width, height); + gtk_render_frame (style, cr, x, y, width, height); - int cell_area_x = cell_area->x, cell_area_y = cell_area->y; - if (bcell->active) { - cell_area->x += DEPRESS_PAD; - cell_area->y += DEPRESS_PAD; - } + // paint content - // paint ensure_pixbuf (bcell, widget); if (bcell->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, bcell->pixbuf, x, y); - cairo_rectangle (cr, x, y, pixbuf_width, pixbuf_height); + int _x = x + pixbuf_xoffset, _y = y + pixbuf_yoffset; + if (bcell->active) { + _x += DEPRESS_PAD; _y += DEPRESS_PAD; + } + gdk_cairo_set_source_pixbuf (cr, bcell->pixbuf, _x, _y); + cairo_rectangle (cr, _x, _y, pixbuf_width, pixbuf_height); cairo_fill (cr); - cairo_destroy (cr); } PangoLayout *layout = create_layout (bcell, 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", x, y, layout); + int _x = cell_area->x + text_xoffset, _y = cell_area->y + text_yoffset; + if (bcell->active) { + _x += DEPRESS_PAD; _y += DEPRESS_PAD; + } + + gtk_render_layout(style, cr, _x, _y, layout); g_object_unref (G_OBJECT (layout)); } - cell_area->x = cell_area_x; cell_area->y = cell_area_y; + gtk_style_context_restore(style); } static gboolean ygtk_cell_renderer_button_activate (GtkCellRenderer *cell, - GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area, - GdkRectangle *cell_area, GtkCellRendererState flags) + GdkEvent *event, GtkWidget *widget, const gchar *path, const GdkRectangle *background_area, + const GdkRectangle *cell_area, GtkCellRendererState flags) { GdkEventButton *_event = &event->button; if (_event->x >= cell_area->x && _event->x <= cell_area->x + cell_area->width) { Modified: trunk/gtk/src/pkg/ygtkcellrendererbutton.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrendererbutto... ============================================================================== --- trunk/gtk/src/pkg/ygtkcellrendererbutton.h (original) +++ trunk/gtk/src/pkg/ygtkcellrendererbutton.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_CELL_RENDERER_BUTTON_H #define YGTK_CELL_RENDERER_BUTTON_H -#include <gtk/gtkcellrenderertext.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_CELL_RENDERER_BUTTON (ygtk_cell_renderer_button_get_type ()) Modified: trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrenderersideb... ============================================================================== --- trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c (original) +++ trunk/gtk/src/pkg/ygtkcellrenderersidebutton.c Sat Jul 23 07:43:30 2011 @@ -20,7 +20,7 @@ G_DEFINE_TYPE (YGtkCellRendererSideButton, ygtk_cell_renderer_side_button, GTK_TYPE_CELL_RENDERER_TEXT) static void ygtk_cell_renderer_side_button_init (YGtkCellRendererSideButton *bcell) -{ GTK_CELL_RENDERER (bcell)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE; } +{ g_object_set(GTK_CELL_RENDERER(bcell), "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL); } static void free_pixbuf (YGtkCellRendererSideButton *cell) { @@ -93,7 +93,7 @@ } static void ygtk_cell_renderer_side_button_get_size ( - GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area, + GtkCellRenderer *cell, GtkWidget *widget, const GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height) { GTK_CELL_RENDERER_CLASS (ygtk_cell_renderer_side_button_parent_class)->get_size ( @@ -107,9 +107,9 @@ } static void ygtk_cell_renderer_side_button_render ( - GtkCellRenderer *cell, GdkDrawable *window, GtkWidget *widget, - GdkRectangle *background_area, GdkRectangle *cell_area, - GdkRectangle *expose_area, GtkCellRendererState flags) + GtkCellRenderer *cell, cairo_t *cr, GtkWidget *widget, + const GdkRectangle *background_area, const GdkRectangle *cell_area, + GtkCellRendererState flags) { YGtkCellRendererSideButton *bcell = YGTK_CELL_RENDERER_SIDE_BUTTON (cell); GdkRectangle text_area = *cell_area; @@ -120,20 +120,25 @@ text_area.x += icon_width + 8; text_area.width -= icon_width + 8 + 4; } + GTK_CELL_RENDERER_CLASS (ygtk_cell_renderer_side_button_parent_class)->render ( - cell, window, widget, background_area, &text_area, expose_area, flags); + cell, cr, widget, background_area, &text_area, flags); if (bcell->button_visible) { GtkStateType state = GTK_STATE_NORMAL; - GtkShadowType shadow = GTK_SHADOW_OUT; - if (!cell->sensitive || GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE) + gboolean sensitive = TRUE; + g_object_get(cell, "sensitive", &sensitive, NULL); + if (!sensitive || gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) state = GTK_STATE_INSENSITIVE; /* else if ((flags & GTK_CELL_RENDERER_PRELIT)) state = GTK_STATE_PRELIGHT;*/ - if (bcell->active) { - shadow = GTK_SHADOW_IN; + if (bcell->active) state = GTK_STATE_ACTIVE; - } + + GtkStyleContext *style = gtk_widget_get_style_context(widget); + gtk_style_context_save(style); + gtk_style_context_set_state(style, state); + gtk_style_context_add_class (style, GTK_STYLE_CLASS_BUTTON); GdkRectangle button_area = *cell_area; if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) @@ -143,29 +148,30 @@ button_area.width = icon_width + 4; button_area.height = icon_height + 4; button_area.y = cell_area->y + ((cell_area->height - button_area.height) / 2); - gtk_paint_box (widget->style, window, state, shadow, expose_area, widget, - "button", button_area.x, button_area.y, button_area.width, button_area.height); + + gtk_render_background (style, cr, button_area.x, button_area.y, button_area.width, button_area.height); + gtk_render_frame (style, cr, button_area.x, button_area.y, button_area.width, button_area.height); GdkRectangle icon_area = button_area; icon_area.x += 2; icon_area.y += 2; if (bcell->active) { - cell_area->x += 2; - cell_area->y += 2; + icon_area.x += 2; + icon_area.y += 2; } ensure_pixbuf (bcell, widget); - cairo_t *cr = gdk_cairo_create (window); gdk_cairo_set_source_pixbuf (cr, bcell->pixbuf, icon_area.x, icon_area.y); cairo_rectangle (cr, icon_area.x, icon_area.y, icon_width, icon_height); cairo_fill (cr); - cairo_destroy (cr); + + gtk_style_context_restore(style); } } static gboolean ygtk_cell_renderer_side_button_activate ( GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, - GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags) + const GdkRectangle *background_area, const GdkRectangle *cell_area, GtkCellRendererState flags) { YGtkCellRendererSideButton *bcell = YGTK_CELL_RENDERER_SIDE_BUTTON (cell); if (bcell->button_visible) { Modified: trunk/gtk/src/pkg/ygtkcellrenderersidebutton.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrenderersideb... ============================================================================== --- trunk/gtk/src/pkg/ygtkcellrenderersidebutton.h (original) +++ trunk/gtk/src/pkg/ygtkcellrenderersidebutton.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_CELL_RENDERER_SIDE_BUTTON_H #define YGTK_CELL_RENDERER_SIDE_BUTTON_H -#include <gtk/gtkcellrenderertext.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_CELL_RENDERER_SIDE_BUTTON (ygtk_cell_renderer_side_button_get_type()) Modified: trunk/gtk/src/pkg/ygtkcellrenderertext.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrenderertext.... ============================================================================== --- trunk/gtk/src/pkg/ygtkcellrenderertext.c (original) +++ trunk/gtk/src/pkg/ygtkcellrenderertext.c Sat Jul 23 07:43:30 2011 @@ -21,27 +21,32 @@ } static void ygtk_cell_renderer_text_render ( - GtkCellRenderer *cell, GdkDrawable *window, GtkWidget *widget, - GdkRectangle *background_area, GdkRectangle *cell_area, - GdkRectangle *expose_area, GtkCellRendererState flags) + GtkCellRenderer *cell, cairo_t *cr, GtkWidget *widget, + const GdkRectangle *background_area, const GdkRectangle *cell_area, + GtkCellRendererState flags) { + // hack: disable our color attributes when the text is selected, + // so that the text is visible against the blue background GtkCellRendererText *tcell = GTK_CELL_RENDERER_TEXT (cell); PangoAttrList *old_extra_attrs = 0, *new_extra_attrs = 0; if (flags & (GTK_CELL_RENDERER_SELECTED | GTK_CELL_RENDERER_INSENSITIVE)) { - old_extra_attrs = pango_attr_list_copy (tcell->extra_attrs); - new_extra_attrs = tcell->extra_attrs; + g_object_get(tcell, "attributes", &old_extra_attrs, NULL); + g_object_get(tcell, "attributes", &new_extra_attrs, NULL); - PangoAttrList *t = pango_attr_list_filter (tcell->extra_attrs, + PangoAttrList *t = pango_attr_list_filter (new_extra_attrs, filter_color_cb, NULL); + + g_object_set(tcell, "attributes", new_extra_attrs, NULL); + pango_attr_list_unref (new_extra_attrs); pango_attr_list_unref (t); } GTK_CELL_RENDERER_CLASS (ygtk_cell_renderer_text_parent_class)->render ( - cell, window, widget, background_area, cell_area, expose_area, flags); + cell, cr, widget, background_area, cell_area, flags); if (old_extra_attrs) { - tcell->extra_attrs = old_extra_attrs; - pango_attr_list_unref (new_extra_attrs); + g_object_set(tcell, "attributes", old_extra_attrs, NULL); + pango_attr_list_unref (old_extra_attrs); } } Modified: trunk/gtk/src/pkg/ygtkcellrenderertext.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkcellrenderertext.... ============================================================================== --- trunk/gtk/src/pkg/ygtkcellrenderertext.h (original) +++ trunk/gtk/src/pkg/ygtkcellrenderertext.h Sat Jul 23 07:43:30 2011 @@ -9,7 +9,7 @@ #ifndef YGTK_CELL_RENDERER_TEXT_H #define YGTK_CELL_RENDERER_TEXT_H -#include <gtk/gtkcellrenderertext.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_CELL_RENDERER_TEXT (ygtk_cell_renderer_text_get_type()) Modified: trunk/gtk/src/pkg/ygtkpkgdetailview.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgdetailview.cc?... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgdetailview.cc (original) +++ trunk/gtk/src/pkg/ygtkpkgdetailview.cc Sat Jul 23 07:43:30 2011 @@ -209,7 +209,7 @@ G_CALLBACK (copy_link_cb), pThis); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); } - gtk_menu_popup (GTK_MENU (pThis->popup), NULL, NULL, NULL, NULL, + gtk_menu_popup (GTK_MENU (pThis->popup), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time()); pThis->link_str = link; } @@ -394,7 +394,7 @@ GtkWidget *widget = hbox; if ((versions.size() % 2) == 1) - g_signal_connect (G_OBJECT (widget), "expose-event", + g_signal_connect (G_OBJECT (widget), "draw", G_CALLBACK (draw_gray_cb), NULL); versions.push_back (version); gtk_box_pack_start (GTK_BOX (versions_box), widget, FALSE, TRUE, 0); @@ -615,17 +615,15 @@ g_list_free (children); } - static gboolean draw_gray_cb (GtkWidget *widget, GdkEventExpose *event) + static gboolean draw_gray_cb (GtkWidget *widget, cairo_t *cr) { - GtkAllocation *alloc = &widget->allocation; - int x = alloc->x, y = alloc->y, w = alloc->width, h = alloc->height; + int w = gtk_widget_get_allocated_width(widget); + int h = gtk_widget_get_allocated_height(widget); - cairo_t *cr = gdk_cairo_create (widget->window); - cairo_rectangle (cr, x, y, w, h); + cairo_rectangle (cr, 0, 0, w, h); // use alpha to cope with styles who might not have a white background cairo_set_source_rgba (cr, 0, 0, 0, .060); cairo_fill (cr); - cairo_destroy (cr); return FALSE; } }; @@ -771,7 +769,7 @@ static const char *getLabel (int dep) { - + switch ((zypp::Dep::for_use_in_switch) dep) { case zypp::Dep::PROVIDES_e: return "Provides:"; case zypp::Dep::PREREQUIRES_e: return "Pre-requires:"; @@ -1198,7 +1196,7 @@ GtkWidget *child = gtk_event_box_new(); gtk_container_add (GTK_CONTAINER (child), hbox); - GdkColor *color = &detail_description->style->base [GTK_STATE_NORMAL]; + GdkColor *color = >k_widget_get_style(detail_description)->base [GTK_STATE_NORMAL]; gtk_widget_modify_bg (child, GTK_STATE_NORMAL, color); m_scroll = gtk_scrolled_window_new (NULL, NULL); @@ -1253,7 +1251,10 @@ { GtkScrolledWindow *_scroll = GTK_SCROLLED_WINDOW (scroll); GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment (_scroll); - int height = scroll->allocation.height; + GtkAllocation alloc; + gtk_widget_get_allocation(scroll, &alloc); + + int height = alloc.height; gdouble increment; switch (step) { case GTK_MOVEMENT_DISPLAY_LINES: @@ -1263,17 +1264,17 @@ increment = height * 0.9; break; case GTK_MOVEMENT_DISPLAY_LINE_ENDS: - increment = adj->upper - adj->lower; + increment = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_lower(adj); break; default: increment = 0.0; break; } - gdouble value = adj->value + (count * increment); - value = MIN (value, adj->upper - adj->page_size); - value = MAX (value, adj->lower); - if (value != adj->value) + gdouble value = gtk_adjustment_get_value(adj) + (count * increment); + value = MIN (value, gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj)); + value = MAX (value, gtk_adjustment_get_lower(adj)); + if (value != gtk_adjustment_get_value(adj)) gtk_adjustment_set_value (adj, value); } Modified: trunk/gtk/src/pkg/ygtkpkgdetailview.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgdetailview.h?r... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgdetailview.h (original) +++ trunk/gtk/src/pkg/ygtkpkgdetailview.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_PKG_DETAIL_VIEW_H #define YGTK_PKG_DETAIL_VIEW_H -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> #include "yzyppwrapper.h" struct YGtkPkgDetailView Modified: trunk/gtk/src/pkg/ygtkpkgfilterview.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgfilterview.h?r... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgfilterview.h (original) +++ trunk/gtk/src/pkg/ygtkpkgfilterview.h Sat Jul 23 07:43:30 2011 @@ -16,7 +16,7 @@ #define YGTK_PKG_FILTER_VIEW_H #include "ygtkpkgquerywidget.h" -#include <gtk/gtktreestore.h> +#include <gtk/gtk.h> struct YGtkPkgFilterModel // abstract { Modified: trunk/gtk/src/pkg/ygtkpkghistorydialog.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkghistorydialog.... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkghistorydialog.cc (original) +++ trunk/gtk/src/pkg/ygtkpkghistorydialog.cc Sat Jul 23 07:43:30 2011 @@ -504,7 +504,7 @@ gtk_tree_view_get_model (date_view), &iter)) gtk_tree_selection_select_iter (selection, &iter); - gdk_window_set_cursor (dialog->window, NULL); + gdk_window_set_cursor (gtk_widget_get_window(GTK_WIDGET(dialog)), NULL); return FALSE; } @@ -637,7 +637,8 @@ gtk_paned_pack1 (GTK_PANED (hpaned), date_scroll, FALSE, FALSE); gtk_paned_pack2 (GTK_PANED (hpaned), log_scroll, TRUE, FALSE); YGUtils::setPaneRelPosition (hpaned, .30); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hpaned); + gtk_widget_set_vexpand (hpaned, TRUE); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), hpaned); gtk_widget_show_all (dialog); m_dialog = dialog; @@ -654,7 +655,7 @@ G_CALLBACK (date_selection_changed_cb), log_view); GdkCursor *cursor = gdk_cursor_new (GDK_WATCH); - gdk_window_set_cursor (dialog->window, cursor); + gdk_window_set_cursor (gtk_widget_get_window(GTK_WIDGET(dialog)), cursor); gdk_cursor_unref (cursor); GtkWidget **views = g_new (GtkWidget *, 3); Modified: trunk/gtk/src/pkg/ygtkpkghistorydialog.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkghistorydialog.... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkghistorydialog.h (original) +++ trunk/gtk/src/pkg/ygtkpkghistorydialog.h Sat Jul 23 07:43:30 2011 @@ -9,7 +9,7 @@ #ifndef YGTK_PKG_HISTORY_DIALOG_H #define YGTK_PKG_HISTORY_DIALOG_H -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> struct YGtkPkgHistoryDialog { Modified: trunk/gtk/src/pkg/ygtkpkglistview.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkglistview.cc?re... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkglistview.cc (original) +++ trunk/gtk/src/pkg/ygtkpkglistview.cc Sat Jul 23 07:43:30 2011 @@ -515,7 +515,7 @@ static void selection_changed_cb (GtkTreeSelection *selection, YGtkPkgListView *pThis) { - if (GTK_WIDGET_REALIZED (pThis->impl->view) && pThis->impl->listener) + if (gtk_widget_get_realized (pThis->impl->view) && pThis->impl->listener) pThis->impl->listener->selectionChanged(); } @@ -742,7 +742,7 @@ gtk_tree_selection_select_path (selection, path); gtk_tree_path_free (path); } - else if (GTK_WIDGET_REALIZED (impl->view)) + else if (gtk_widget_get_realized (impl->view)) gtk_tree_view_scroll_to_point (GTK_TREE_VIEW (impl->view), -1, 0); } Modified: trunk/gtk/src/pkg/ygtkpkglistview.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkglistview.h?rev... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkglistview.h (original) +++ trunk/gtk/src/pkg/ygtkpkglistview.h Sat Jul 23 07:43:30 2011 @@ -9,7 +9,7 @@ #define YGTK_PKG_LIST_VIEW_H #include "yzyppwrapper.h" -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> enum Property { INSTALLED_CHECK_PROP, NAME_PROP, ACTION_NAME_PROP, NAME_SUMMARY_PROP, Modified: trunk/gtk/src/pkg/ygtkpkgmenubar.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgmenubar.cc?rev... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgmenubar.cc (original) +++ trunk/gtk/src/pkg/ygtkpkgmenubar.cc Sat Jul 23 07:43:30 2011 @@ -450,7 +450,8 @@ struct CheckMenuFlag { CheckMenuFlag (GtkWidget *menu, const char *text) { - m_item = gtk_check_menu_item_new_with_mnemonic (text); + std::string str (YGUtils::mapKBAccel(text)); + m_item = gtk_check_menu_item_new_with_mnemonic (str.c_str()); g_object_set_data_full (G_OBJECT (m_item), "this", this, destructor); gtk_menu_shell_append (GTK_MENU_SHELL (menu), m_item); } Modified: trunk/gtk/src/pkg/ygtkpkgmenubar.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgmenubar.h?rev=... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgmenubar.h (original) +++ trunk/gtk/src/pkg/ygtkpkgmenubar.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_PKG_MENU_BAR_H #define YGTK_PKG_MENU_BAR_H -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> struct YGtkPkgMenuBar { Modified: trunk/gtk/src/pkg/ygtkpkgpatternview.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgpatternview.h?... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgpatternview.h (original) +++ trunk/gtk/src/pkg/ygtkpkgpatternview.h Sat Jul 23 07:43:30 2011 @@ -9,7 +9,7 @@ #define YGTK_PKG_PATTERN_LIST_H #include "ygtkpkgquerywidget.h" -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> struct YGtkPkgPatternView : public YGtkPkgQueryWidget { Modified: trunk/gtk/src/pkg/ygtkpkgproductdialog.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgproductdialog.... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgproductdialog.cc (original) +++ trunk/gtk/src/pkg/ygtkpkgproductdialog.cc Sat Jul 23 07:43:30 2011 @@ -98,7 +98,7 @@ sel->candidateObj().isSatisfied() || sel->hasInstalledObj(), TEXT_COLUMN, text.c_str(), VERSION_COLUMN, version.c_str(), VENDOR_COLUMN, prod->vendor().c_str(), DESCRIPTION_COLUMN, - description.c_str(), -1); + description.c_str(), -1); } GtkWidget *description = ygtk_rich_text_new(); @@ -121,7 +121,7 @@ renderer = gtk_cell_renderer_toggle_new(); column = gtk_tree_view_column_new_with_attributes ( NULL, renderer, "active", INSTALLED_COLUMN, NULL); - g_object_set (G_OBJECT (renderer), "sensitive", FALSE, NULL); + gtk_cell_renderer_set_sensitive(renderer, FALSE); gtk_tree_view_append_column (tview, column); renderer = gtk_cell_renderer_text_new(); @@ -167,7 +167,8 @@ gtk_paned_pack1 (GTK_PANED (vpaned), scroll, TRUE, FALSE); gtk_paned_pack2 (GTK_PANED (vpaned), description_scroll, FALSE, TRUE); YGUtils::setPaneRelPosition (vpaned, .70); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vpaned); + gtk_widget_set_vexpand (vpaned, TRUE); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), vpaned); gtk_widget_show_all (dialog); m_dialog = dialog; Modified: trunk/gtk/src/pkg/ygtkpkgproductdialog.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgproductdialog.... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgproductdialog.h (original) +++ trunk/gtk/src/pkg/ygtkpkgproductdialog.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_PKG_PRODUCT_DIALOG_H #define YGTK_PKG_PRODUCT_DIALOG_H -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> struct YGtkPkgProductDialog { Modified: trunk/gtk/src/pkg/ygtkpkgquerycombo.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgquerycombo.cc?... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgquerycombo.cc (original) +++ trunk/gtk/src/pkg/ygtkpkgquerycombo.cc Sat Jul 23 07:43:30 2011 @@ -51,7 +51,7 @@ YGtkPkgQueryCombo::YGtkPkgQueryCombo (Factory *factory) : impl (new Impl (factory)) { - impl->combo = gtk_combo_box_new_text(); + impl->combo = gtk_combo_box_text_new(); gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (impl->combo), YGUtils::empty_row_is_separator_cb, GINT_TO_POINTER (0), NULL); g_signal_connect_after (G_OBJECT (impl->combo), "changed", @@ -70,8 +70,8 @@ void YGtkPkgQueryCombo::add (const char *title) { - GtkComboBox *combo = GTK_COMBO_BOX (impl->combo); - gtk_combo_box_append_text (combo, title); + GtkComboBoxText *combo = GTK_COMBO_BOX_TEXT (impl->combo); + gtk_combo_box_text_append (combo, NULL, title); } void YGtkPkgQueryCombo::setActive (int index) Modified: trunk/gtk/src/pkg/ygtkpkgquerycombo.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgquerycombo.h?r... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgquerycombo.h (original) +++ trunk/gtk/src/pkg/ygtkpkgquerycombo.h Sat Jul 23 07:43:30 2011 @@ -10,7 +10,7 @@ #define YGTK_PKG_QUERY_COMBO_H #include "ygtkpkgquerywidget.h" -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> struct YGtkPkgQueryCombo : public YGtkPkgQueryWidget { Modified: trunk/gtk/src/pkg/ygtkpkgquerywidget.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgquerywidget.h?... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgquerywidget.h (original) +++ trunk/gtk/src/pkg/ygtkpkgquerywidget.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_PKG_QUERY_WIDGET_H #define YGTK_PKG_QUERY_WIDGET_H -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> #include "yzyppwrapper.h" struct YGtkPkgQueryWidget Modified: trunk/gtk/src/pkg/ygtkpkgrpmgroupsview.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgrpmgroupsview.... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgrpmgroupsview.h (original) +++ trunk/gtk/src/pkg/ygtkpkgrpmgroupsview.h Sat Jul 23 07:43:30 2011 @@ -9,7 +9,7 @@ #define YGTK_PKG_RPM_GROUP_VIEW_H #include "ygtkpkgquerywidget.h" -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> struct YGtkPkgRpmGroupsView : public YGtkPkgQueryWidget { Modified: trunk/gtk/src/pkg/ygtkpkgsearchentry.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgsearchentry.cc... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgsearchentry.cc (original) +++ trunk/gtk/src/pkg/ygtkpkgsearchentry.cc Sat Jul 23 07:43:30 2011 @@ -98,13 +98,14 @@ GtkWidget *label = gtk_label_new_with_mnemonic (label_str.c_str()); gtk_label_set_mnemonic_widget (GTK_LABEL (label), impl->entry); - impl->combo = gtk_combo_box_new_text(); - gtk_combo_box_append_text (GTK_COMBO_BOX (impl->combo), _("Name & Summary")); - gtk_combo_box_append_text (GTK_COMBO_BOX (impl->combo), _("Description")); + impl->combo = gtk_combo_box_text_new(); + GtkComboBoxText *combot = GTK_COMBO_BOX_TEXT (impl->combo); + gtk_combo_box_text_append (combot, 0, _("Name & Summary")); + gtk_combo_box_text_append (combot, 0, _("Description")); if (!YGPackageSelector::get()->onlineUpdateMode()) { - gtk_combo_box_append_text (GTK_COMBO_BOX (impl->combo), _("File name")); - gtk_combo_box_append_text (GTK_COMBO_BOX (impl->combo), "RPM Provides"); - gtk_combo_box_append_text (GTK_COMBO_BOX (impl->combo), "RPM Requires"); + gtk_combo_box_text_append (combot, 0, _("File name")); + gtk_combo_box_text_append (combot, 0, "RPM Provides"); + gtk_combo_box_text_append (combot, 0, "RPM Requires"); } gtk_combo_box_set_active (GTK_COMBO_BOX (impl->combo), 0); YGUtils::shrinkWidget (impl->combo); Modified: trunk/gtk/src/pkg/ygtkpkgstatusbar.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgstatusbar.cc?r... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgstatusbar.cc (original) +++ trunk/gtk/src/pkg/ygtkpkgstatusbar.cc Sat Jul 23 07:43:30 2011 @@ -19,9 +19,6 @@ #include "yzyppwrapper.h" #include <gtk/gtk.h> -static void enlarge_width_size_request_cb (GtkWidget *widget, GtkRequisition *req) -{ req->width += 4; } - struct LastChange { GtkWidget *hbox, *icon, *text, *undo_button; @@ -36,8 +33,6 @@ gtk_misc_set_alignment (GTK_MISC (text), 0, .5); undo_button = gtk_button_new_from_stock (GTK_STOCK_UNDO); YGUtils::shrinkWidget (undo_button); - g_signal_connect (G_OBJECT (undo_button), "size-request", - G_CALLBACK (enlarge_width_size_request_cb), NULL); g_signal_connect (G_OBJECT (undo_button), "clicked", G_CALLBACK (undo_clicked_cb), this); gchar *str = g_strdup_printf ("(<a href="more">%s</a>)", _("view all changes")); @@ -117,13 +112,16 @@ void set_ellipsize (GtkWidget *label) { GtkWidget *hbox = gtk_widget_get_parent (this->hbox); - if (GTK_WIDGET_REALIZED (hbox)) { + if (gtk_widget_get_realized (hbox)) { gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_NONE); GtkRequisition req; gtk_widget_size_request (hbox, &req); GtkWidget *window = gtk_widget_get_toplevel (hbox); - bool ellipsize = req.width > window->allocation.width - 10; + GtkAllocation allocation; + gtk_widget_get_allocation(window, &allocation); + + bool ellipsize = req.width > allocation.width - 10; PangoEllipsizeMode mode = ellipsize ? PANGO_ELLIPSIZE_MIDDLE : PANGO_ELLIPSIZE_NONE; gtk_label_set_ellipsize (GTK_LABEL (label), mode); Modified: trunk/gtk/src/pkg/ygtkpkgstatusbar.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgstatusbar.h?re... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgstatusbar.h (original) +++ trunk/gtk/src/pkg/ygtkpkgstatusbar.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_PKG_STATUS_BAR_H #define YGTK_PKG_STATUS_BAR_H -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> struct YGtkPkgUndoList; Modified: trunk/gtk/src/pkg/ygtkpkgundolist.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgundolist.cc?re... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgundolist.cc (original) +++ trunk/gtk/src/pkg/ygtkpkgundolist.cc Sat Jul 23 07:43:30 2011 @@ -307,7 +307,8 @@ if (onApply) gtk_box_pack_start (GTK_BOX (vbox), create_close_when_done_check(), FALSE, TRUE, 0); gtk_widget_show (vbox); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); + gtk_widget_set_vexpand (vbox, TRUE); + gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), vbox); int ret = gtk_dialog_run (GTK_DIALOG (dialog)); if (ret == 1) Modified: trunk/gtk/src/pkg/ygtkpkgvestigialdialog.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgvestigialdialo... ============================================================================== --- trunk/gtk/src/pkg/ygtkpkgvestigialdialog.h (original) +++ trunk/gtk/src/pkg/ygtkpkgvestigialdialog.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_PKG_VESTIGIAL_DIALOG_H #define YGTK_PKG_VESTIGIAL_DIALOG_H -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> struct YGtkPkgVestigialDialog { Modified: trunk/gtk/src/pkg/ygtktreemodel.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtktreemodel.h?rev=6... ============================================================================== --- trunk/gtk/src/pkg/ygtktreemodel.h (original) +++ trunk/gtk/src/pkg/ygtktreemodel.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_TREE_MODEL_H #define YGTK_TREE_MODEL_H -#include <gtk/gtktreemodel.h> +#include <gtk/gtk.h> struct YGtkTreeModel { Modified: trunk/gtk/src/ygdkmngloader.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygdkmngloader.c?rev=64969... ============================================================================== --- trunk/gtk/src/ygdkmngloader.c (original) +++ trunk/gtk/src/ygdkmngloader.c Sat Jul 23 07:43:30 2011 @@ -132,8 +132,7 @@ { gboolean error = FALSE; FILE *file = fopen (filename, "rb"); - if (!file) - { + if (!file) { SET_ERROR ("Could not open specified file") return NULL; } @@ -147,8 +146,7 @@ fileno (file), 0); if (data == MAP_FAILED) SET_ERROR ("Could not map file") - else - { + else { mng_pixbuf = ygdk_mng_pixbuf_new_from_data (data, file_size, error_msg); munmap (data, file_size); } @@ -162,8 +160,7 @@ DataStream data = data_stream_constructor (raw_data, size); gboolean error = FALSE; - if (!read_signature (&data)) - { + if (!read_signature (&data)) { SET_ERROR ("Not a MNG file") return NULL; } @@ -179,8 +176,7 @@ do { error = !read_uint32 (&data, &chunk_size); error = error || !read_uint32 (&data, &chunk_id); - if (error) - { + if (error) { SET_ERROR ("Unexpected end of file on new chunk") break; } Modified: trunk/gtk/src/ygtkbargraph.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkbargraph.c?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkbargraph.c (original) +++ trunk/gtk/src/ygtkbargraph.c Sat Jul 23 07:43:30 2011 @@ -20,10 +20,21 @@ ygtk_bar_graph_set_style (bar, TRUE); } -static void ygtk_bar_graph_size_request (GtkWidget *widget, GtkRequisition *requisition) +static void +ygtk_bar_graph_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height) { - GTK_WIDGET_CLASS (ygtk_bar_graph_parent_class)->size_request (widget, requisition); - requisition->height += 18; // give room for the labels + GTK_WIDGET_CLASS (ygtk_bar_graph_parent_class)->get_preferred_height (widget, minimal_height, natural_height); + *natural_height = *minimal_height = *minimal_height + 18; // give room for the labels +} + +static void +ygtk_bar_graph_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + GTK_WIDGET_CLASS (ygtk_bar_graph_parent_class)->get_preferred_width (widget, minimal_width, natural_width); } GtkWidget *ygtk_bar_graph_new (void) @@ -33,7 +44,7 @@ void ygtk_bar_graph_create_entries (YGtkBarGraph *bar, guint entries) { - YGtkRatioBox *box = YGTK_RATIO_BOX (GTK_BIN (bar)->child); + YGtkRatioBox *box = YGTK_RATIO_BOX (gtk_bin_get_child(GTK_BIN (bar))); // Remove the ones in excess guint i; @@ -56,7 +67,7 @@ static GtkWidget *ygtk_bar_graph_get_label (YGtkBarGraph *bar, int index, GtkWidget **b) { - YGtkRatioBox *hbox = YGTK_RATIO_BOX (GTK_BIN (bar)->child); + YGtkRatioBox *hbox = YGTK_RATIO_BOX (gtk_bin_get_child(GTK_BIN (bar))); 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 +103,7 @@ // Set proportion gtk_widget_set_size_request (box, 0, -1); - YGtkRatioBox *hbox = YGTK_RATIO_BOX (GTK_BIN (bar)->child); + YGtkRatioBox *hbox = YGTK_RATIO_BOX (gtk_bin_get_child(GTK_BIN (bar))); ygtk_ratio_box_set_child_packing (hbox, box, MAX (value, 1)); // Set background color @@ -129,7 +140,7 @@ YGtkColoredLabel *color_label = YGTK_COLORED_LABEL (label); const guint *color = palette [index % G_N_ELEMENTS (palette)]; - GdkColor gcolor = { 0, color[0] << 8, color[1] << 8, color[2] << 8 }; + GdkRGBA gcolor = { color[0] / 255., color[1] / 255., color[2] / 255., 0 }; ygtk_colored_label_set_background (color_label, &gcolor); } @@ -140,13 +151,13 @@ gtk_frame_set_shadow_type (GTK_FRAME (bar), shadow); } -void ygtk_bar_graph_customize_bg (YGtkBarGraph *bar, int index, GdkColor *color) +void ygtk_bar_graph_customize_bg (YGtkBarGraph *bar, int index, GdkRGBA *color) { GtkWidget *label = ygtk_bar_graph_get_label (bar, index, NULL); ygtk_colored_label_set_background (YGTK_COLORED_LABEL (label), color); } -void ygtk_bar_graph_customize_fg (YGtkBarGraph *bar, int index, GdkColor *color) +void ygtk_bar_graph_customize_fg (YGtkBarGraph *bar, int index, GdkRGBA *color) { GtkWidget *label = ygtk_bar_graph_get_label (bar, index, NULL); ygtk_colored_label_set_foreground (YGTK_COLORED_LABEL (label), color); @@ -157,7 +168,8 @@ ygtk_bar_graph_parent_class = g_type_class_peek_parent (klass); GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass); - widget_class->size_request = ygtk_bar_graph_size_request; + widget_class->get_preferred_width = ygtk_bar_graph_get_preferred_width; + widget_class->get_preferred_height = ygtk_bar_graph_get_preferred_height; } //** YGtkColoredLabel @@ -172,55 +184,49 @@ static inline double pixel_clamp (double val) { return MAX (0, MIN (1, val)); } -static gboolean ygtk_colored_label_expose_event (GtkWidget *widget, GdkEventExpose *event) +static gboolean ygtk_colored_label_on_draw (GtkWidget *widget, cairo_t *cr) { - GtkAllocation *alloc = &widget->allocation; + GtkStyleContext *ctx; + ctx = gtk_widget_get_style_context(widget); + + GdkRGBA color; + gtk_style_context_get_background_color(ctx, GTK_STATE_NORMAL, &color); + + cairo_save(cr); + int width = gtk_widget_get_allocated_width (widget); + int height = gtk_widget_get_allocated_height (widget); + cairo_scale (cr, width, height); - GdkColor *bg_color = &widget->style->bg[GTK_STATE_NORMAL]; - double red = (bg_color->red >> 8) / 255.; - double green = (bg_color->green >> 8) / 255.; - double blue = (bg_color->blue >> 8) / 255.; - - cairo_t *cr = gdk_cairo_create (event->window); - cairo_translate (cr, alloc->x, alloc->y); - cairo_scale (cr, alloc->width, alloc->height); - - double x, y, w, h; - x = alloc->x; - y = alloc->y; - w = alloc->width; - h = alloc->height; cairo_pattern_t *grad = cairo_pattern_create_linear (0, 0, 0, 1); - cairo_pattern_add_color_stop_rgba (grad, 0, pixel_clamp (red+.3), pixel_clamp (green+.3), pixel_clamp (blue+.3), 1); - cairo_pattern_add_color_stop_rgba (grad, 0.70, red, green, blue, 1); - cairo_pattern_add_color_stop_rgba (grad, 1, pixel_clamp (red-.2), pixel_clamp (green-.2), pixel_clamp (blue-.2), 1); + cairo_pattern_add_color_stop_rgba (grad, 0, pixel_clamp (color.red+.3), pixel_clamp (color.green+.3), pixel_clamp (color.blue+.3), 1); + cairo_pattern_add_color_stop_rgba (grad, 0.70, color.red, color.green, color.blue, 1); + cairo_pattern_add_color_stop_rgba (grad, 1, pixel_clamp (color.red-.2), pixel_clamp (color.green-.2), pixel_clamp (color.blue-.2), 1); cairo_rectangle (cr, 0, 0, 1, 1); cairo_set_source (cr, grad); cairo_fill (cr); cairo_pattern_destroy (grad); - cairo_destroy (cr); - - GTK_WIDGET_CLASS (ygtk_colored_label_parent_class)->expose_event (widget, event); + cairo_restore(cr); + GTK_WIDGET_CLASS (ygtk_colored_label_parent_class)->draw (widget, cr); return FALSE; } GtkWidget *ygtk_colored_label_new (void) { return g_object_new (YGTK_TYPE_COLORED_LABEL, NULL); } -void ygtk_colored_label_set_background (YGtkColoredLabel *label, GdkColor *color) -{ gtk_widget_modify_bg (GTK_WIDGET (label), GTK_STATE_NORMAL, color); } +void ygtk_colored_label_set_background (YGtkColoredLabel *label, GdkRGBA *color) +{ gtk_widget_override_background_color (GTK_WIDGET (label), GTK_STATE_NORMAL, color); } -void ygtk_colored_label_set_foreground (YGtkColoredLabel *label, GdkColor *color) -{ gtk_widget_modify_fg (GTK_WIDGET (label), GTK_STATE_NORMAL, color); } +void ygtk_colored_label_set_foreground (YGtkColoredLabel *label, GdkRGBA *color) +{ gtk_widget_override_color (GTK_WIDGET (label), GTK_STATE_NORMAL, color); } static void ygtk_colored_label_class_init (YGtkColoredLabelClass *klass) { ygtk_colored_label_parent_class = g_type_class_peek_parent (klass); GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass); - widget_class->expose_event = ygtk_colored_label_expose_event; + widget_class->draw = ygtk_colored_label_on_draw; } Modified: trunk/gtk/src/ygtkbargraph.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkbargraph.h?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkbargraph.h (original) +++ trunk/gtk/src/ygtkbargraph.h Sat Jul 23 07:43:30 2011 @@ -9,7 +9,7 @@ #ifndef YGTK_BAR_GRAPH_H #define YGTK_BAR_GRAPH_H -#include <gtk/gtkframe.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_BAR_GRAPH (ygtk_bar_graph_get_type ()) @@ -46,8 +46,8 @@ void ygtk_bar_graph_setup_entry (YGtkBarGraph *bar, int index, const gchar *label_entry, int value); void ygtk_bar_graph_set_style (YGtkBarGraph *bar, gboolean flat); -void ygtk_bar_graph_customize_bg (YGtkBarGraph *bar, int index, GdkColor *color); -void ygtk_bar_graph_customize_fg (YGtkBarGraph *bar, int index, GdkColor *color); +void ygtk_bar_graph_customize_bg (YGtkBarGraph *bar, int index, GdkRGBA *color); +void ygtk_bar_graph_customize_fg (YGtkBarGraph *bar, int index, GdkRGBA *color); G_END_DECLS #endif /*YGTK_BAR_GRAPH_H*/ @@ -55,7 +55,6 @@ #ifndef YGTK_COLORED_LABEL_H #define YGTK_COLORED_LABEL_H -#include <gtk/gtklabel.h> G_BEGIN_DECLS /* YGtkColoredLabel is a GtkLabel where gtk_modify_bg() can be used. It also @@ -88,8 +87,8 @@ // A convenience function (you may use gtk_widget_modify_fg() and // gtk_widget_modify_bg() instead), where colors range is [0, 255] -void ygtk_colored_label_set_foreground (YGtkColoredLabel *label, GdkColor *color); -void ygtk_colored_label_set_background (YGtkColoredLabel *label, GdkColor *color); +void ygtk_colored_label_set_foreground (YGtkColoredLabel *label, GdkRGBA *color); +void ygtk_colored_label_set_background (YGtkColoredLabel *label, GdkRGBA *color); G_END_DECLS #endif /*YGTK_COLORED_LABEL*/ Modified: trunk/gtk/src/ygtkfieldentry.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfieldentry.c?rev=6496... ============================================================================== --- trunk/gtk/src/ygtkfieldentry.c (original) +++ trunk/gtk/src/ygtkfieldentry.c Sat Jul 23 07:43:30 2011 @@ -184,7 +184,7 @@ filter_entry_signal = g_signal_new ("field_entry_changed", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (YGtkFieldEntryClass, filter_entry_changed), - NULL, NULL, gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); + NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); } gboolean ygtk_field_entry_set_focus (YGtkFieldEntry *fields) Modified: trunk/gtk/src/ygtkfieldentry.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfieldentry.h?rev=6496... ============================================================================== --- trunk/gtk/src/ygtkfieldentry.h (original) +++ trunk/gtk/src/ygtkfieldentry.h Sat Jul 23 07:43:30 2011 @@ -12,8 +12,7 @@ #ifndef YGTK_FIELD_ENTRY_H #define YGTK_FIELD_ENTRY_H -#include <gtk/gtkhbox.h> -#include <gtk/gtkentry.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_FIELD_ENTRY (ygtk_field_entry_get_type ()) @@ -43,7 +42,7 @@ GtkWidget* ygtk_field_entry_new (void); GType ygtk_field_entry_get_type (void) G_GNUC_CONST; -// if this is the first field, separator will be ignored. +// if this is the first field, separator will be ignored. guint ygtk_field_entry_add_field (YGtkFieldEntry *entry, gchar separator); // max_length can be 0 to disable it. valids_chars can be NULL to disable it. void ygtk_field_entry_setup_field (YGtkFieldEntry *entry, guint index, Modified: trunk/gtk/src/ygtkfixed.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfixed.c?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkfixed.c (original) +++ trunk/gtk/src/ygtkfixed.c Sat Jul 23 07:43:30 2011 @@ -14,14 +14,15 @@ static void ygtk_fixed_init (YGtkFixed *fixed) { - GTK_WIDGET_SET_FLAGS (fixed, GTK_NO_WINDOW); + gtk_widget_set_has_window(GTK_WIDGET(fixed), FALSE); gtk_widget_set_redraw_on_allocate (GTK_WIDGET (fixed), FALSE); } -void ygtk_fixed_setup (YGtkFixed *fixed, YGtkPreferredSize cb1, YGtkSetSize cb2, gpointer data) +void ygtk_fixed_setup (YGtkFixed *fixed, YGtkPreferredWidth cb1, YGtkPreferredHeight cb2, YGtkSetSize cb3, gpointer data) { - fixed->preferred_size_cb = cb1; - fixed->set_size_cb = cb2; + fixed->preferred_width_cb = cb1; + fixed->preferred_height_cb = cb2; + fixed->set_size_cb = cb3; fixed->data = data; } @@ -68,7 +69,7 @@ for (i = fixed->children; i; i = i->next) { YGtkFixedChild *child = i->data; if (child->widget == widget) { - gboolean was_visible = GTK_WIDGET_VISIBLE (widget); + gboolean was_visible = gtk_widget_get_visible (widget); gtk_widget_unparent (widget); fixed->children = g_slist_delete_link (fixed->children, i); g_free (child); @@ -92,12 +93,24 @@ } } -static void ygtk_fixed_size_request (GtkWidget *widget, GtkRequisition *requisition) +static void +ygtk_fixed_get_preferred_width (GtkWidget *widget, + gint *minimum_width, + gint *natural_width) { YGtkFixed *fixed = YGTK_FIXED (widget); - fixed->preferred_size_cb (fixed, &requisition->width, &requisition->height, - fixed->data); - GTK_WIDGET_CLASS (ygtk_fixed_parent_class)->size_request (widget, requisition); + *natural_width = *minimum_width = + fixed->preferred_width_cb (fixed, fixed->data); +} + +static void +ygtk_fixed_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height) +{ + YGtkFixed *fixed = YGTK_FIXED (widget); + *natural_height = *minimum_height = + fixed->preferred_height_cb (fixed, fixed->data); } static void ygtk_fixed_size_allocate (GtkWidget *widget, GtkAllocation *allocation) @@ -134,7 +147,8 @@ container_class->child_type = ygtk_fixed_child_type; GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - widget_class->size_request = ygtk_fixed_size_request; + widget_class->get_preferred_width = ygtk_fixed_get_preferred_width; + widget_class->get_preferred_height = ygtk_fixed_get_preferred_height; widget_class->size_allocate = ygtk_fixed_size_allocate; } Modified: trunk/gtk/src/ygtkfixed.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkfixed.h?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkfixed.h (original) +++ trunk/gtk/src/ygtkfixed.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_FIXED_H #define YGTK_FIXED_H -#include <gtk/gtkcontainer.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_FIXED (ygtk_fixed_get_type ()) @@ -26,7 +26,8 @@ typedef struct _YGtkFixed YGtkFixed; typedef struct _YGtkFixedClass YGtkFixedClass; -typedef void (*YGtkPreferredSize) (YGtkFixed *, gint *, gint *, gpointer); +typedef gint (*YGtkPreferredWidth) (YGtkFixed *, gpointer); +typedef gint (*YGtkPreferredHeight) (YGtkFixed *, gpointer); typedef void (*YGtkSetSize) (YGtkFixed *, gint, gint, gpointer); struct _YGtkFixed @@ -34,7 +35,8 @@ GtkContainer parent; // private (read-only): GSList *children; - YGtkPreferredSize preferred_size_cb; + YGtkPreferredWidth preferred_width_cb; + YGtkPreferredHeight preferred_height_cb; YGtkSetSize set_size_cb; gpointer data; }; @@ -54,7 +56,7 @@ GType ygtk_fixed_get_type (void) G_GNUC_CONST; -void ygtk_fixed_setup (YGtkFixed *fixed, YGtkPreferredSize cb1, YGtkSetSize cb2, gpointer data); +void ygtk_fixed_setup (YGtkFixed *fixed, YGtkPreferredWidth cb1, YGtkPreferredHeight cb2, YGtkSetSize cb3, gpointer data); void ygtk_fixed_set_child_pos (YGtkFixed *fixed, GtkWidget *widget, gint x, gint y); void ygtk_fixed_set_child_size (YGtkFixed *fixed, GtkWidget *widget, gint width, gint height); Modified: trunk/gtk/src/ygtkhtmlwrap.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkhtmlwrap.c?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkhtmlwrap.c (original) +++ trunk/gtk/src/ygtkhtmlwrap.c Sat Jul 23 07:43:30 2011 @@ -6,12 +6,11 @@ // check the header file for information about this widget #include <config.h> -#include <gtk/gtkversion.h> +#include <gtk/gtk.h> #include <string.h> #include "ygtkhtmlwrap.h" // ygutils -#include <gtk/gtktextview.h> void ygutils_scrollAdj (GtkAdjustment *vadj, gboolean top); GtkWidget *ygtk_html_wrap_new (void) @@ -313,7 +312,7 @@ void ygtk_html_wrap_scroll (GtkWidget *widget, gboolean top) { - ygutils_scrollAdj (GTK_TEXT_VIEW (widget)->vadjustment, top); + ygutils_scrollAdj (gtk_text_view_get_vadjustment(GTK_TEXT_VIEW (widget)), top); } gboolean ygtk_html_wrap_search (GtkWidget *widget, const gchar *text) Modified: trunk/gtk/src/ygtkhtmlwrap.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkhtmlwrap.h?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkhtmlwrap.h (original) +++ trunk/gtk/src/ygtkhtmlwrap.h Sat Jul 23 07:43:30 2011 @@ -11,7 +11,7 @@ #ifndef YGTK_HTML_WRAP_H #define YGTK_HTML_WRAP_H -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> G_BEGIN_DECLS GtkWidget *ygtk_html_wrap_new (void); Modified: trunk/gtk/src/ygtkimage.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkimage.c?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkimage.c (original) +++ trunk/gtk/src/ygtkimage.c Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #include <config.h> #include "ygdkmngloader.h" #include "ygtkimage.h" -#include <gtk/gtkiconfactory.h> +#include <gtk/gtk.h> G_DEFINE_TYPE (YGtkImage, ygtk_image, GTK_TYPE_DRAWING_AREA) @@ -35,14 +35,14 @@ } } -static void ygtk_image_destroy (GtkObject *object) +static void ygtk_image_destroy (GtkWidget *widget) { - YGtkImage *image = YGTK_IMAGE (object); + YGtkImage *image = YGTK_IMAGE (widget); if (image->alt_text) g_free (image->alt_text); image->alt_text = NULL; ygtk_image_free_pixbuf (image); - GTK_OBJECT_CLASS (ygtk_image_parent_class)->destroy (object); + GTK_WIDGET_CLASS (ygtk_image_parent_class)->destroy (widget); } static void ygtk_image_set_pixbuf (YGtkImage *image, GdkPixbuf *pixbuf, const char *error_msg) @@ -143,8 +143,8 @@ GError *error = 0; if (anim && ygdk_mng_pixbuf_is_data_mng (data, data_size)) { GdkPixbufAnimation *pixbuf; - pixbuf = ygdk_mng_pixbuf_new_from_data (data, data_size, &error); - ygtk_image_set_animation (image, pixbuf, error ? error->message : "(undefined)"); + pixbuf = ygdk_mng_pixbuf_new_from_data (data, data_size, &error); + ygtk_image_set_animation (image, pixbuf, error ? error->message : "(undefined)"); } else { image->animated = anim; @@ -190,6 +190,26 @@ requisition->height = height; } +static void +ygtk_image_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + GtkRequisition requisition; + ygtk_image_size_request (widget, &requisition); + *minimal_width = *natural_width = requisition.width; +} + +static void +ygtk_image_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height) +{ + GtkRequisition requisition; + ygtk_image_size_request (widget, &requisition); + *minimal_height = *natural_height = requisition.height; +} + static GdkPixbuf *ygtk_image_render_state (GtkWidget *widget, GdkPixbuf *pixbuf) { // as in GtkImage @@ -198,21 +218,19 @@ gtk_icon_source_set_pixbuf (source, pixbuf); gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_icon_source_set_size_wildcarded (source, FALSE); - rendered = gtk_style_render_icon (widget->style, source, - gtk_widget_get_direction (widget), GTK_WIDGET_STATE (widget), - /* arbitrary */ (GtkIconSize)-1, widget, "gtk-image"); + rendered = gtk_render_icon_pixbuf (gtk_widget_get_style_context(widget), source, (GtkIconSize)-1); gtk_icon_source_free (source); return rendered; } -static gboolean ygtk_image_expose_event (GtkWidget *widget, GdkEventExpose *event) +static gboolean ygtk_image_draw_event (GtkWidget *widget, cairo_t *cr) { YGtkImage *image = YGTK_IMAGE (widget); - int width, height; - width = widget->allocation.width; - height = widget->allocation.height; - cairo_t *cr = gdk_cairo_create (widget->window); + GtkRequisition req; + gtk_widget_get_preferred_size (widget, &req, NULL); + int width = gtk_widget_get_allocated_width(widget); + int height = gtk_widget_get_allocated_height(widget); if (!image->loaded) { if (image->alt_text) { @@ -221,15 +239,14 @@ layout = gtk_widget_create_pango_layout (widget, image->alt_text); int x, y; - x = (width - widget->requisition.width) / 2; - y = (height - widget->requisition.height) / 2; + x = (width - req.width) / 2; + y = (height - req.height) / 2; cairo_move_to (cr, x, y); pango_cairo_show_layout (cr, layout); g_object_unref (layout); } - cairo_destroy (cr); return FALSE; } @@ -239,13 +256,13 @@ else pixbuf = image->pixbuf; - gboolean needs_transform = GTK_WIDGET_STATE (widget) != GTK_STATE_NORMAL; + gboolean needs_transform = gtk_widget_get_state (widget) != GTK_STATE_NORMAL; if (needs_transform) pixbuf = ygtk_image_render_state (widget, pixbuf); int x = 0, y = 0; if (image->align == CENTER_IMAGE_ALIGN) { - x = (width - widget->requisition.width) / 2; - y = (height - widget->requisition.height) / 2; + x = (width - req.width) / 2; + y = (height - req.height) / 2; } gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y); @@ -270,7 +287,6 @@ cairo_rectangle (cr, x, y, width, height); cairo_fill (cr); - cairo_destroy (cr); if (needs_transform) g_object_unref (G_OBJECT (pixbuf)); return FALSE; @@ -284,10 +300,9 @@ static void ygtk_image_class_init (YGtkImageClass *klass) { GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass); - widget_class->expose_event = ygtk_image_expose_event; - widget_class->size_request = ygtk_image_size_request; - - GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); - gtkobject_class->destroy = ygtk_image_destroy; + widget_class->draw = ygtk_image_draw_event; + widget_class->get_preferred_width = ygtk_image_get_preferred_width; + widget_class->get_preferred_height = ygtk_image_get_preferred_height; + widget_class->destroy = ygtk_image_destroy; } Modified: trunk/gtk/src/ygtkimage.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkimage.h?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkimage.h (original) +++ trunk/gtk/src/ygtkimage.h Sat Jul 23 07:43:30 2011 @@ -10,8 +10,8 @@ #ifndef YGTK_IMAGE_H #define YGTK_IMAGE_H -#include <gtk/gtkdrawingarea.h> -#include <gdk/gdkpixbuf.h> +#include <gtk/gtk.h> +#include <gdk/gdk.h> G_BEGIN_DECLS @@ -68,7 +68,7 @@ void ygtk_image_set_from_pixbuf (YGtkImage *image, GdkPixbuf *pixbuf); void ygtk_image_set_props (YGtkImage *image, YGtkImageAlign align, const gchar *alt_text); -// as we don't have a window, +// as we don't have a window, G_END_DECLS Modified: trunk/gtk/src/ygtklinklabel.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtklinklabel.c?rev=64969... ============================================================================== --- trunk/gtk/src/ygtklinklabel.c (original) +++ trunk/gtk/src/ygtklinklabel.c Sat Jul 23 07:43:30 2011 @@ -16,17 +16,19 @@ static void ygtk_link_label_init (YGtkLinkLabel *label) { - GTK_WIDGET_SET_FLAGS (label, GTK_NO_WINDOW); + gtk_widget_set_has_window(GTK_WIDGET(label), FALSE); } static void ygtk_link_label_realize (GtkWidget *widget) { GTK_WIDGET_CLASS (ygtk_link_label_parent_class)->realize (widget); GdkWindowAttr attributes; - attributes.x = widget->allocation.x; - attributes.y = widget->allocation.y; - attributes.width = widget->allocation.width; - attributes.height = widget->allocation.height; + GtkAllocation alloc; + gtk_widget_get_allocation(widget, &alloc); + attributes.x = alloc.x; + attributes.y = alloc.y; + attributes.width = alloc.width; + attributes.height = alloc.height; attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.event_mask = gtk_widget_get_events (widget) | @@ -36,12 +38,11 @@ gtk_widget_get_display (widget), GDK_HAND2); YGtkLinkLabel *label = YGTK_LINK_LABEL (widget); - label->link_window = gdk_window_new (widget->window, &attributes, attributes_mask); + label->link_window = gdk_window_new (gtk_widget_get_window(widget), &attributes, attributes_mask); gdk_window_set_user_data (label->link_window, widget); GdkColor white = { 0, 0xffff, 0xffff, 0xffff }; - gdk_rgb_find_color (gtk_widget_get_colormap (widget), &white); gdk_window_set_background (label->link_window, &white); - gdk_cursor_unref (attributes.cursor); + g_object_unref (G_OBJECT(attributes.cursor)); } static void ygtk_link_label_unrealize (GtkWidget *widget) @@ -108,13 +109,15 @@ YGtkLinkLabel *label = YGTK_LINK_LABEL (widget); ygtk_link_label_ensure_layout (label); requisition->width = requisition->height = 0; + GtkStyleContext *style_ctx; + style_ctx = gtk_widget_get_style_context(widget); // if (label->text && *label->text) { PangoContext *context; PangoFontMetrics *metrics; gint ascent, descent; context = pango_layout_get_context (label->layout); - metrics = pango_context_get_metrics (context, widget->style->font_desc, + metrics = pango_context_get_metrics (context, gtk_style_context_get_font(style_ctx, GTK_STATE_FLAG_NORMAL), pango_context_get_language (context)); ascent = pango_font_metrics_get_ascent (metrics); descent = pango_font_metrics_get_descent (metrics); @@ -123,6 +126,26 @@ } } +static void +ygtk_link_label_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + GtkRequisition requisition; + ygtk_link_label_size_request (widget, &requisition); + *minimal_width = *natural_width = requisition.width; +} + +static void +ygtk_link_label_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height) +{ + GtkRequisition requisition; + ygtk_link_label_size_request (widget, &requisition); + *minimal_height = *natural_height = requisition.height; +} + #define SPACING 4 static void ygtk_link_label_size_allocate (GtkWidget *widget, GtkAllocation *allocation) @@ -158,29 +181,27 @@ } } -static gboolean ygtk_link_label_expose_event (GtkWidget *widget, GdkEventExpose *event) +static gboolean ygtk_link_label_on_draw (GtkWidget *widget, cairo_t *cr) { YGtkLinkLabel *label = YGTK_LINK_LABEL (widget); ygtk_link_label_ensure_layout (label); - gint x = 0, y = 0; - PangoLayout *layout = 0; - if (event->window == widget->window) { + GtkStyleContext *style = gtk_widget_get_style_context(widget); + if (gtk_cairo_should_draw_window(cr, gtk_widget_get_window(widget))) { + gint x = 0; + gint width = gtk_widget_get_allocated_width (widget); if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) { PangoRectangle extent; pango_layout_get_extents (label->layout, NULL, &extent); - x = widget->allocation.width - extent.width/PANGO_SCALE; + x = width - extent.width/PANGO_SCALE; } - x += widget->allocation.x; - y += widget->allocation.y; - layout = label->layout; - } - else if (event->window == label->link_window) - layout = label->link_layout; - - if (layout) - gtk_paint_layout (widget->style, event->window, GTK_WIDGET_STATE (widget), - FALSE, &event->area, widget, "label", x, y, layout); + gtk_render_layout (style, cr, x, 0, label->layout); + } + + if (gtk_cairo_should_draw_window(cr, label->link_window)) { + gtk_cairo_transform_to_window (cr, widget, label->link_window); + gtk_render_layout (style, cr, 0, 0, label->link_layout); + } return FALSE; } @@ -190,8 +211,8 @@ return TRUE; } -void ygtk_link_label_set_text (YGtkLinkLabel *label, const gchar *text, const gchar *link, - gboolean link_always_visible) +void ygtk_link_label_set_text (YGtkLinkLabel *label, + const gchar *text, const gchar *link, gboolean link_always_visible) { g_free (label->text); label->text = g_strdup (text); @@ -219,9 +240,12 @@ widget_class->realize = ygtk_link_label_realize; widget_class->unrealize = ygtk_link_label_unrealize; widget_class->map = ygtk_link_label_map; - widget_class->size_request = ygtk_link_label_size_request; + + widget_class->get_preferred_height = ygtk_link_label_get_preferred_height; + widget_class->get_preferred_width = ygtk_link_label_get_preferred_width; + widget_class->size_allocate = ygtk_link_label_size_allocate; - widget_class->expose_event = ygtk_link_label_expose_event; + widget_class->draw = ygtk_link_label_on_draw; widget_class->button_press_event = ygtk_link_label_button_press_event; GObjectClass *gobject_class = G_OBJECT_CLASS (klass); Modified: trunk/gtk/src/ygtklinklabel.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtklinklabel.h?rev=64969... ============================================================================== --- trunk/gtk/src/ygtklinklabel.h (original) +++ trunk/gtk/src/ygtklinklabel.h Sat Jul 23 07:43:30 2011 @@ -12,7 +12,7 @@ #ifndef YGTK_LINK_LABEL_H #define YGTK_LINK_LABEL_H -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_LINK_LABEL (ygtk_link_label_get_type ()) Modified: trunk/gtk/src/ygtkmenubutton.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkmenubutton.c?rev=6496... ============================================================================== --- trunk/gtk/src/ygtkmenubutton.c (original) +++ trunk/gtk/src/ygtkmenubutton.c Sat Jul 23 07:43:30 2011 @@ -33,7 +33,7 @@ static gboolean ygtk_popup_window_key_press_event (GtkWidget *widget, GdkEventKey *event) { - if (event->keyval == GDK_Escape) { + if (event->keyval == GDK_KEY_Escape) { gtk_widget_hide (widget); return TRUE; } @@ -54,7 +54,7 @@ while (child) { if (child == widget) return FALSE; - child = child->parent; + child = gtk_widget_get_parent(child); } gtk_widget_hide (widget); return TRUE; @@ -88,7 +88,7 @@ *y = monitor.y; else if (*y + req.height > monitor.y + monitor.height) *y = monitor.y + monitor.height - req.height; -} +} void ygtk_popup_window_popup (GtkWidget *widget, gint x, gint y, guint activate_time) { @@ -100,10 +100,10 @@ gtk_widget_show (widget); // grab this with your teeth - if (gdk_pointer_grab (widget->window, TRUE, + if (gdk_pointer_grab (gtk_widget_get_window(widget), TRUE, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, NULL, NULL, activate_time) == 0) - if (gdk_keyboard_grab (widget->window, TRUE, activate_time) != 0) + if (gdk_keyboard_grab (gtk_widget_get_window(widget), TRUE, activate_time) != 0) gdk_pointer_ungrab (activate_time); } @@ -143,26 +143,27 @@ static void ygtk_menu_button_get_popup_pos (YGtkMenuButton *button, gint *x, gint *y) { GtkWidget *widget = GTK_WIDGET (button); - GtkAllocation *button_alloc = &widget->allocation; + GtkAllocation button_alloc; + gtk_widget_get_allocation(widget, &button_alloc); // the popup would look awful if smaller than the button GtkRequisition req; gtk_widget_size_request (button->popup, &req); int popup_width = req.width, popup_height = req.height; - if (button_alloc->width > req.width) { - gtk_widget_set_size_request (button->popup, button_alloc->width, -1); - popup_width = button_alloc->width; + if (button_alloc.width > req.width) { + gtk_widget_set_size_request (button->popup, button_alloc.width, -1); + popup_width = button_alloc.width; } - gdk_window_get_origin (widget->window, x, y); - *x += button_alloc->x - popup_width*button->xalign; - *y += (button_alloc->y-popup_height) + (button_alloc->height+popup_height)*button->yalign; + gdk_window_get_origin (gtk_widget_get_window(widget), x, y); + *x += button_alloc.x - popup_width*button->xalign; + *y += (button_alloc.y-popup_height) + (button_alloc.height+popup_height)*button->yalign; // GTK doesn't push up menus if they are near the bottom, but we will... int screen_height; screen_height = gdk_screen_get_height (gtk_widget_get_screen (widget)); if (*y > screen_height - popup_height) - *y -= popup_height + button_alloc->height; + *y -= popup_height + button_alloc.height; } static void ygtk_menu_button_get_menu_pos (GtkMenu *menu, gint *x, gint *y, Modified: trunk/gtk/src/ygtkmenubutton.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkmenubutton.h?rev=6496... ============================================================================== --- trunk/gtk/src/ygtkmenubutton.h (original) +++ trunk/gtk/src/ygtkmenubutton.h Sat Jul 23 07:43:30 2011 @@ -11,7 +11,7 @@ #ifndef YGTK_POPUP_WINDOW_H #define YGTK_POPUP_WINDOW_H -#include <gtk/gtkwindow.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_POPUP_WINDOW (ygtk_popup_window_get_type ()) @@ -48,8 +48,6 @@ #ifndef YGTK_MENU_BUTTON_H #define YGTK_MENU_BUTTON_H -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkmenu.h> G_BEGIN_DECLS #define YGTK_TYPE_MENU_BUTTON (ygtk_menu_button_get_type ()) Modified: trunk/gtk/src/ygtkratiobox.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.c?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkratiobox.c (original) +++ trunk/gtk/src/ygtkratiobox.c Sat Jul 23 07:43:30 2011 @@ -13,7 +13,7 @@ static void ygtk_ratio_box_init (YGtkRatioBox *box) { - GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET(box), FALSE); gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), FALSE); } @@ -61,7 +61,7 @@ for (child = box->children; child; child = child->next) { YGtkRatioBoxChild *box_child = (YGtkRatioBoxChild*) child->data; if (box_child->widget == widget) { - gboolean was_visible = GTK_WIDGET_VISIBLE (widget); + gboolean was_visible = gtk_widget_get_visible (widget); gtk_widget_unparent (widget); box->children = g_list_remove_link (box->children, child); @@ -93,10 +93,9 @@ /* We put size_request and _allocate in the same functions for both orientations because it's just easier to maintain having the logic in the same place. */ - -static void ygtk_ratio_box_size_request (GtkWidget *widget, - GtkRequisition *requisition, - GtkOrientation orientation) +static void ygtk_ratio_box_get_preferred_size (GtkWidget *widget, + GtkRequisition *requisition, + GtkOrientation orientation) { requisition->width = requisition->height = 0; @@ -105,15 +104,16 @@ GList *i; for (i = box->children; i; i = i->next) { YGtkRatioBoxChild* child = i->data; - if (!GTK_WIDGET_VISIBLE (child->widget)) + if (!gtk_widget_get_visible (child->widget)) continue; - GtkRequisition child_req; - gtk_widget_size_request (child->widget, &child_req); + GtkRequisition min_child_req; + GtkRequisition nat_child_req; + gtk_widget_get_preferred_size (child->widget, &min_child_req, &nat_child_req); if (orientation == GTK_ORIENTATION_HORIZONTAL) - requisition->height = MAX (requisition->height, child_req.height); + requisition->height = MAX (requisition->height, min_child_req.height); else - requisition->width = MAX (requisition->width, child_req.width); + requisition->width = MAX (requisition->width, min_child_req.width); children_nb++; } gint spacing = children_nb ? box->spacing*(children_nb-1) : 0; @@ -122,7 +122,7 @@ else requisition->height += spacing; - int border = GTK_CONTAINER (box)->border_width; + int border = gtk_container_get_border_width(GTK_CONTAINER (box)); requisition->width += border*2; requisition->height += border*2; } @@ -139,7 +139,7 @@ GList* i; for (i = box->children; i; i = i->next) { YGtkRatioBoxChild* child = i->data; - if (!GTK_WIDGET_VISIBLE (child->widget)) + if (!gtk_widget_get_visible (child->widget)) continue; ratios_sum += child->ratio; @@ -148,7 +148,7 @@ gint spacing = children_nb ? box->spacing*(children_nb-1) : 0; - int border = GTK_CONTAINER (box)->border_width; + int border = gtk_container_get_border_width(GTK_CONTAINER (box)); int x = allocation->x + border, y = allocation->y + border, width = allocation->width - border*2, height = allocation->height - border*2; @@ -161,11 +161,12 @@ for (i = box->children; i; i = i->next) { YGtkRatioBoxChild* child = i->data; - if (!GTK_WIDGET_VISIBLE (child->widget)) + if (!gtk_widget_get_visible (child->widget)) continue; - GtkRequisition child_req; - gtk_widget_get_child_requisition (child->widget, &child_req); + //GtkRequisition min_child_req; + //GtkRequisition nat_child_req; + //gtk_widget_get_preferred_size (child->widget, &min_child_req, &nat_child_req); gint child_length = (child->ratio * length) / ratios_sum; if (!i->next) // last takes rest (any residual length) @@ -199,7 +200,7 @@ if (child_info) { gtk_widget_freeze_child_notify (child); child_info->ratio = ratio; - if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box)) + if (gtk_widget_get_visible (child) && gtk_widget_get_visible (GTK_WIDGET(box))) gtk_widget_queue_resize (child); gtk_widget_thaw_child_notify (child); @@ -229,9 +230,29 @@ static void ygtk_ratio_hbox_init (YGtkRatioHBox *box) { } -static void ygtk_ratio_hbox_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ ygtk_ratio_box_size_request (widget, requisition, GTK_ORIENTATION_HORIZONTAL); } +static void ygtk_ratio_hbox_get_preferred_size (GtkWidget *widget, + GtkRequisition *requisition) +{ ygtk_ratio_box_get_preferred_size (widget, requisition, GTK_ORIENTATION_HORIZONTAL); } + +static void +ygtk_ratio_hbox_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + GtkRequisition requisition; + ygtk_ratio_hbox_get_preferred_size (widget, &requisition); + *minimal_width = *natural_width = requisition.width; +} + +static void +ygtk_ratio_hbox_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height) +{ + GtkRequisition requisition; + ygtk_ratio_hbox_get_preferred_size (widget, &requisition); + *minimal_height = *natural_height = requisition.height; +} static void ygtk_ratio_hbox_size_allocate (GtkWidget *widget, GtkAllocation *allocation) @@ -249,7 +270,9 @@ ygtk_ratio_hbox_parent_class = (YGtkRatioBoxClass*) g_type_class_peek_parent (klass); GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass); - widget_class->size_request = ygtk_ratio_hbox_size_request; + widget_class->get_preferred_width = ygtk_ratio_hbox_get_preferred_width; + widget_class->get_preferred_height = ygtk_ratio_hbox_get_preferred_height; + widget_class->size_allocate = ygtk_ratio_hbox_size_allocate; } @@ -260,9 +283,29 @@ static void ygtk_ratio_vbox_init (YGtkRatioVBox *box) { } -static void ygtk_ratio_vbox_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ ygtk_ratio_box_size_request (widget, requisition, GTK_ORIENTATION_VERTICAL); } +static void ygtk_ratio_vbox_get_preferred_size (GtkWidget *widget, + GtkRequisition *requisition) +{ ygtk_ratio_box_get_preferred_size (widget, requisition, GTK_ORIENTATION_VERTICAL); } + +static void +ygtk_ratio_vbox_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + GtkRequisition requisition; + ygtk_ratio_vbox_get_preferred_size (widget, &requisition); + *minimal_width = *natural_width = requisition.width; +} + +static void +ygtk_ratio_vbox_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height) +{ + GtkRequisition requisition; + ygtk_ratio_vbox_get_preferred_size (widget, &requisition); + *minimal_height = *natural_height = requisition.height; +} static void ygtk_ratio_vbox_size_allocate (GtkWidget *widget, GtkAllocation *allocation) @@ -280,7 +323,8 @@ ygtk_ratio_vbox_parent_class = g_type_class_peek_parent (klass); GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass); - widget_class->size_request = ygtk_ratio_vbox_size_request; + widget_class->get_preferred_width = ygtk_ratio_vbox_get_preferred_width; + widget_class->get_preferred_height = ygtk_ratio_vbox_get_preferred_height; widget_class->size_allocate = ygtk_ratio_vbox_size_allocate; } @@ -290,18 +334,18 @@ static void ygtk_adj_size_init (YGtkAdjSize *adj_size) { - GTK_WIDGET_SET_FLAGS (adj_size, GTK_NO_WINDOW); + gtk_widget_set_has_window(GTK_WIDGET(adj_size), FALSE); gtk_widget_set_redraw_on_allocate (GTK_WIDGET (adj_size), FALSE); } -static void ygtk_adj_size_size_request (GtkWidget *widget, - GtkRequisition *requisition) +static void ygtk_adj_size_get_preferred_size (GtkWidget *widget, + GtkRequisition *requisition) { - GtkWidget *child = GTK_BIN (widget)->child; + GtkWidget *child = gtk_bin_get_child(GTK_BIN (widget)); requisition->width = requisition->height = 0; - if (child && GTK_WIDGET_VISIBLE (child)) { + if (child && gtk_widget_get_visible((child))) { gtk_widget_size_request (child, requisition); - guint border = GTK_CONTAINER (widget)->border_width; + guint border = gtk_container_get_border_width(GTK_CONTAINER (widget)); requisition->width += border * 2; requisition->height += border * 2; @@ -327,13 +371,34 @@ } } +static void +ygtk_adj_size_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + GtkRequisition requisition; + ygtk_adj_size_get_preferred_size (widget, &requisition); + *minimal_width = *natural_width = requisition.width; +} + +static void +ygtk_adj_size_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height) +{ + GtkRequisition requisition; + ygtk_adj_size_get_preferred_size (widget, &requisition); + *minimal_height = *natural_height = requisition.height; +} + + static void ygtk_adj_size_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - GtkWidget *child = GTK_BIN (widget)->child; - if (child && GTK_WIDGET_VISIBLE (child)) { + GtkWidget *child = gtk_bin_get_child(GTK_BIN (widget)); + if (child && gtk_widget_get_visible (child)) { GtkAllocation child_alloc = *allocation; - guint border = GTK_CONTAINER (widget)->border_width; + guint border = gtk_container_get_border_width(GTK_CONTAINER (widget)); child_alloc.x += border; child_alloc.y += border; child_alloc.width -= border * 2; @@ -378,7 +443,8 @@ ygtk_adj_size_parent_class = g_type_class_peek_parent (klass); GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass); - widget_class->size_request = ygtk_adj_size_size_request; + widget_class->get_preferred_width = ygtk_adj_size_get_preferred_width; + widget_class->get_preferred_height = ygtk_adj_size_get_preferred_height; widget_class->size_allocate = ygtk_adj_size_size_allocate; } Modified: trunk/gtk/src/ygtkratiobox.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkratiobox.h?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkratiobox.h (original) +++ trunk/gtk/src/ygtkratiobox.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_RATIO_BOX_H #define YGTK_RATIO_BOX_H -#include <gtk/gtkcontainer.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_RATIO_BOX (ygtk_ratio_box_get_type ()) @@ -112,7 +112,6 @@ #ifndef YGTK_ADJ_SIZE_H #define YGTK_ADJ_SIZE_H -#include <gtk/gtkbin.h> G_BEGIN_DECLS #define YGTK_TYPE_ADJ_SIZE (ygtk_adj_size_get_type ()) Modified: trunk/gtk/src/ygtkrichtext.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkrichtext.c?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtkrichtext.c (original) +++ trunk/gtk/src/ygtkrichtext.c Sat Jul 23 07:43:30 2011 @@ -150,13 +150,13 @@ "foreground", "#000000", NULL); } -static void ygtk_rich_text_destroy (GtkObject *object) +static void ygtk_rich_text_destroy (GtkWidget *widget) { // destroy can be called multiple times, and we must ref only once - YGtkRichText *rtext = YGTK_RICH_TEXT (object); + YGtkRichText *rtext = YGTK_RICH_TEXT (widget); gdk_cursor_unref (rtext->hand_cursor); ygtk_rich_text_set_background (rtext, NULL); - GTK_OBJECT_CLASS (ygtk_rich_text_parent_class)->destroy (object); + GTK_WIDGET_CLASS (ygtk_rich_text_parent_class)->destroy(widget); } // Change the cursor to the "hands" cursor typically used by web browsers, @@ -165,9 +165,12 @@ { if (wx == -1) { GtkWidget *widget = GTK_WIDGET (view); - gdk_window_get_pointer (widget->window, &wx, &wy, NULL); - if (wx < 0 || wy < 0 || wx >= widget->allocation.width || - wy >= widget->allocation.height) + GtkAllocation alloc; + gtk_widget_get_allocation(widget, &alloc); + + gdk_window_get_pointer (gtk_widget_get_window(widget), &wx, &wy, NULL); + if (wx < 0 || wy < 0 || wx >= alloc.width || + wy >= alloc.height) return; } @@ -191,25 +194,29 @@ return TRUE; } -static gboolean ygtk_rich_text_expose_event (GtkWidget *widget, GdkEventExpose *event) +static gboolean ygtk_rich_text_draw (GtkWidget *widget, cairo_t *cr) { GtkTextView *text = GTK_TEXT_VIEW (widget); YGtkRichText *rtext = YGTK_RICH_TEXT (widget); + GtkAllocation alloc; + gtk_widget_get_allocation(widget, &alloc); if (rtext->background_pixbuf) { GdkWindow *window = gtk_text_view_get_window (text, GTK_TEXT_WINDOW_TEXT); - if (event->window == window) { + if (gtk_cairo_should_draw_window(cr, window)) { int x, y; int width = gdk_pixbuf_get_width (rtext->background_pixbuf); int height = gdk_pixbuf_get_height (rtext->background_pixbuf); gtk_text_view_buffer_to_window_coords (text, GTK_TEXT_WINDOW_TEXT, - widget->allocation.width-((2*width)/5), -height/3, &x, &y); - gdk_draw_pixbuf (GDK_DRAWABLE (window), *widget->style->fg_gc, rtext->background_pixbuf, - 0, 0, x, y, -1, -1, GDK_RGB_DITHER_NONE, 0, 0); + alloc.width-((2*width)/5), -height/3, &x, &y); + + gtk_cairo_transform_to_window(cr, widget, window); + gdk_cairo_set_source_pixbuf (cr, rtext->background_pixbuf, x, y); + cairo_paint (cr); } } gboolean ret; - ret = GTK_WIDGET_CLASS (ygtk_rich_text_parent_class)->expose_event (widget, event); + ret = GTK_WIDGET_CLASS (ygtk_rich_text_parent_class)->draw (widget, cr); set_cursor_if_appropriate (text, -1, -1); return ret; } @@ -722,10 +729,8 @@ { GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass); gtkwidget_class->motion_notify_event = ygtk_rich_text_motion_notify_event; - gtkwidget_class->expose_event = ygtk_rich_text_expose_event; - - GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); - gtkobject_class->destroy = ygtk_rich_text_destroy; + gtkwidget_class->draw = ygtk_rich_text_draw; + gtkwidget_class->destroy = ygtk_rich_text_destroy; link_clicked_signal = g_signal_new ("link-clicked", G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST, Modified: trunk/gtk/src/ygtksteps.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtksteps.c?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtksteps.c (original) +++ trunk/gtk/src/ygtksteps.c Sat Jul 23 07:43:30 2011 @@ -39,9 +39,9 @@ steps->current_mark_timeout_id = steps->current_mark_frame = 0; } -static void ygtk_steps_destroy (GtkObject *object) +static void ygtk_steps_destroy (GtkWidget *widget) { - YGtkSteps *steps = YGTK_STEPS (object); + YGtkSteps *steps = YGTK_STEPS (widget); if (steps->current_mark_timeout_id) { g_source_remove (steps->current_mark_timeout_id); steps->current_mark_timeout_id = 0; @@ -54,7 +54,8 @@ 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); + + GTK_WIDGET_CLASS (ygtk_steps_parent_class)->destroy(widget); } static void ygtk_step_update_layout (YGtkSteps *steps, gint step) @@ -79,19 +80,21 @@ g_list_free (children); } -static gboolean ygtk_steps_expose_event (GtkWidget *widget, GdkEventExpose *event) +static gboolean ygtk_steps_draw (GtkWidget *widget, cairo_t *cr) { - GTK_WIDGET_CLASS (ygtk_steps_parent_class)->expose_event (widget, event); + GTK_WIDGET_CLASS (ygtk_steps_parent_class)->draw(widget, cr); YGtkSteps *steps = YGTK_STEPS (widget); gboolean reverse = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; 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++) { GtkWidget *label = i->data; + GtkAllocation alloc; + gtk_widget_get_allocation(label, &alloc); + if (g_object_get_data (G_OBJECT (label), "is-header")) continue; PangoLayout *layout; @@ -101,11 +104,11 @@ 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; + int x = alloc.x, y = alloc.y; if (reverse) { PangoRectangle rect; pango_layout_get_pixel_extents (layout, NULL, &rect); - x += label->allocation.width - rect.width - 4; + x += alloc.width - rect.width - 4; } else x += 4; @@ -122,7 +125,6 @@ cairo_move_to (cr, x, y); pango_cairo_show_layout (cr, layout); } - cairo_destroy (cr); g_list_free (children); return FALSE; } @@ -189,7 +191,7 @@ ygtk_step_update_layout (steps, step); } - if (step != -1) { + if (step != -1 && step != old_step) { steps->current_mark_frame = 0; steps->current_mark_timeout_id = g_timeout_add (CURRENT_MARK_ANIMATION_TIME / CURRENT_MARK_FRAMES_NB, @@ -230,9 +232,7 @@ ygtk_steps_parent_class = g_type_class_peek_parent (klass); GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass); - widget_class->expose_event = ygtk_steps_expose_event; - - GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); - gtkobject_class->destroy = ygtk_steps_destroy; + widget_class->draw = ygtk_steps_draw; + widget_class->destroy = ygtk_steps_destroy; } Modified: trunk/gtk/src/ygtksteps.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtksteps.h?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtksteps.h (original) +++ trunk/gtk/src/ygtksteps.h Sat Jul 23 07:43:30 2011 @@ -18,7 +18,7 @@ #ifndef YGTK_STEPS_H #define YGTK_STEPS_H -#include <gtk/gtkvbox.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_STEPS (ygtk_steps_get_type ()) @@ -42,7 +42,7 @@ PangoLayout *check_mark_layout, *current_mark_layout, *todo_mark_layout; // for current_mark little animation guint current_mark_timeout_id, current_mark_frame; - + } YGtkSteps; typedef struct _YGtkStepsClass Modified: trunk/gtk/src/ygtktextview.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktextview.h?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtktextview.h (original) +++ trunk/gtk/src/ygtktextview.h Sat Jul 23 07:43:30 2011 @@ -9,7 +9,7 @@ #ifndef YGTK_TEXT_VIEW_H #define YGTK_TEXT_VIEW_H -#include <gtk/gtktextview.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_TEXT_VIEW (ygtk_text_view_get_type ()) Modified: trunk/gtk/src/ygtktimezonepicker.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktimezonepicker.c?rev=... ============================================================================== --- trunk/gtk/src/ygtktimezonepicker.c (original) +++ trunk/gtk/src/ygtktimezonepicker.c Sat Jul 23 07:43:30 2011 @@ -72,7 +72,8 @@ gint *map_x, gint *map_y) { int win_width, win_height; - gdk_window_get_size (picker->map_window, &win_width, &win_height); + win_width = gdk_window_get_width(picker->map_window); + win_height = gdk_window_get_height(picker->map_window); *map_x = ((win_x - win_width/2) / picker->scale) + picker->map_x; *map_y = ((win_y - win_height/2) / picker->scale) + picker->map_y; @@ -82,7 +83,8 @@ gint *win_x, gint *win_y) { int win_width, win_height; - gdk_window_get_size (picker->map_window, &win_width, &win_height); + win_width = gdk_window_get_width(picker->map_window); + win_height = gdk_window_get_height(picker->map_window); *win_x = ((map_x - picker->map_x) * picker->scale) + win_width/2; *win_y = ((map_y - picker->map_y) * picker->scale) + win_height/2; @@ -244,12 +246,12 @@ static void ygtk_time_zone_picker_init (YGtkTimeZonePicker *picker) { - GTK_WIDGET_SET_FLAGS (picker, GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET(picker), FALSE); } -static void ygtk_time_zone_picker_destroy (GtkObject *object) +static void ygtk_time_zone_picker_destroy (GtkWidget *widget) { - YGtkTimeZonePicker *picker = YGTK_TIME_ZONE_PICKER (object); + YGtkTimeZonePicker *picker = YGTK_TIME_ZONE_PICKER (widget); if (picker->map_pixbuf) { g_object_unref (G_OBJECT (picker->map_pixbuf)); picker->map_pixbuf = NULL; @@ -267,7 +269,7 @@ g_list_free (picker->locations); picker->locations = NULL; } - GTK_OBJECT_CLASS (ygtk_time_zone_picker_parent_class)->destroy (object); + GTK_WIDGET_CLASS (ygtk_time_zone_picker_parent_class)->destroy(widget); } static void ygtk_time_zone_picker_realize (GtkWidget *widget) @@ -277,11 +279,14 @@ YGtkTimeZonePicker *picker = YGTK_TIME_ZONE_PICKER (widget); GdkWindowAttr attributes; + GtkAllocation alloc; + gtk_widget_get_allocation(widget, &alloc); + attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = widget->allocation.x; - attributes.y = widget->allocation.y; - attributes.width = widget->allocation.width; - attributes.height = widget->allocation.height; + attributes.x = alloc.x; + attributes.y = alloc.y; + attributes.width = alloc.width; + attributes.height = alloc.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= @@ -289,10 +294,12 @@ | GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); gint attributes_mask; attributes_mask = GDK_WA_X | GDK_WA_Y; - picker->map_window = gdk_window_new (widget->window, + picker->map_window = gdk_window_new (gtk_widget_get_window(widget), &attributes, attributes_mask); gdk_window_set_user_data (picker->map_window, widget); - gtk_style_set_background (widget->style, picker->map_window, GTK_STATE_NORMAL); + + GtkStyleContext *style_ctx = gtk_widget_get_style_context(widget); + gtk_style_context_set_background(style_ctx, picker->map_window); ygtk_time_zone_picker_closeup (picker, FALSE, 0, 0, FALSE); } @@ -399,18 +406,22 @@ return FALSE; } -static void ygtk_time_zone_picker_size_request (GtkWidget *widget, - GtkRequisition *requisition) +static void ygtk_time_zone_picker_get_preferred_width (GtkWidget *widget, + gint *minimal_width, gint *natural_width) { - requisition->width = 600; - requisition->height = 300; - GTK_WIDGET_CLASS (ygtk_time_zone_picker_parent_class)->size_request (widget, requisition); + *minimal_width = *natural_width = 600; +} + +static void ygtk_time_zone_picker_get_preferred_height (GtkWidget *widget, + gint *minimal_height, gint *natural_height) +{ + *minimal_height = *natural_height = 300; } static void ygtk_time_zone_picker_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - if (!GTK_WIDGET_REALIZED (widget)) + if (!gtk_widget_get_realized (widget)) return; YGtkTimeZonePicker *picker = YGTK_TIME_ZONE_PICKER (widget); int win_width = allocation->width, win_height = allocation->height; @@ -443,16 +454,13 @@ (widget, allocation); } -static gboolean ygtk_time_zone_picker_expose_event (GtkWidget *widget, - GdkEventExpose *event) +static gboolean ygtk_time_zone_picker_draw (GtkWidget *widget, cairo_t *cr) { YGtkTimeZonePicker *picker = YGTK_TIME_ZONE_PICKER (widget); - if (event->window != picker->map_window) - return FALSE; + GtkStyleContext *style = gtk_widget_get_style_context(widget); - cairo_t *cr = gdk_cairo_create (event->window); - int width, height; - gdk_window_get_size (event->window, &width, &height); + int width = gtk_widget_get_allocated_width(widget); + int height = gtk_widget_get_allocated_height(widget); if (!picker->map_pixbuf) { // show alt text if no image was loaded @@ -537,9 +545,7 @@ } cleanup: - cairo_destroy (cr); - gtk_paint_shadow (widget->style, event->window, GTK_STATE_NORMAL, - GTK_SHADOW_IN, &event->area, widget, "frame", 0, 0, width, height); + gtk_render_frame (style, cr, 0, 0, width, height); return TRUE; } @@ -552,16 +558,15 @@ widget_class->unrealize = ygtk_time_zone_picker_unrealize; widget_class->map = ygtk_time_zone_picker_map; widget_class->unmap = ygtk_time_zone_picker_unmap; - widget_class->expose_event = ygtk_time_zone_picker_expose_event; - widget_class->size_request = ygtk_time_zone_picker_size_request; + widget_class->draw = ygtk_time_zone_picker_draw; + widget_class->get_preferred_width = ygtk_time_zone_picker_get_preferred_width; + widget_class->get_preferred_height = ygtk_time_zone_picker_get_preferred_height; widget_class->size_allocate = ygtk_time_zone_picker_size_allocate; widget_class->button_press_event = ygtk_time_zone_picker_button_press_event; widget_class->button_release_event = ygtk_time_zone_picker_button_release_event; widget_class->motion_notify_event = ygtk_time_zone_picker_motion_notify_event; widget_class->leave_notify_event = ygtk_time_zone_picker_leave_notify_event; - - GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); - gtkobject_class->destroy = ygtk_time_zone_picker_destroy; + widget_class->destroy = ygtk_time_zone_picker_destroy; zone_clicked_signal = g_signal_new ("zone_clicked", G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST, Modified: trunk/gtk/src/ygtktimezonepicker.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktimezonepicker.h?rev=... ============================================================================== --- trunk/gtk/src/ygtktimezonepicker.h (original) +++ trunk/gtk/src/ygtktimezonepicker.h Sat Jul 23 07:43:30 2011 @@ -10,7 +10,7 @@ #ifndef YGTK_TIME_ZONE_PICKER_H #define YGTK_TIME_ZONE_PICKER_H -#include <gtk/gtkwidget.h> +#include <gtk/gtk.h> #include <gdk/gdk.h> G_BEGIN_DECLS Modified: trunk/gtk/src/ygtktreeview.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktreeview.c?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtktreeview.c (original) +++ trunk/gtk/src/ygtktreeview.c Sat Jul 23 07:43:30 2011 @@ -113,27 +113,26 @@ gtk_tree_view_convert_bin_window_to_widget_coords ( view, _popup_x, _popup_y, &_popup_x, &_popup_y); gint x_orig, y_orig; - gdk_window_get_origin (widget->window, &x_orig, &y_orig); + gdk_window_get_origin (gtk_widget_get_window(widget), &x_orig, &y_orig); _popup_x += x_orig; _popup_y += y_orig; g_signal_emit (widget, right_click_signal, 0, outreach); return TRUE; } -static gboolean _ygtk_tree_view_expose_event (GtkWidget *widget, GdkEventExpose *event) +static gboolean _ygtk_tree_view_draw (GtkWidget *widget, cairo_t *cr) { - GTK_WIDGET_CLASS (ygtk_tree_view_parent_class)->expose_event (widget, event); + GTK_WIDGET_CLASS (ygtk_tree_view_parent_class)->draw(widget, cr); GtkTreeView *view = GTK_TREE_VIEW (widget); YGtkTreeView *yview = YGTK_TREE_VIEW (widget); - if (yview->empty_text && event->window == gtk_tree_view_get_bin_window (view)) { + if (yview->empty_text) { GtkTreeModel *model = gtk_tree_view_get_model (view); GtkTreeIter iter; if (!model || !gtk_tree_model_get_iter_first (model, &iter)) { // empty tree-view const gchar *text = yview->empty_text; if (!model) text = _("Loading..."); - cairo_t *cr = gdk_cairo_create (event->window); PangoLayout *layout; layout = gtk_widget_create_pango_layout (widget, text); @@ -144,14 +143,15 @@ int width, height; pango_layout_get_pixel_size (layout, &width, &height); + GtkAllocation allocation; + gtk_widget_get_allocation(widget, &allocation); int x, y; - x = (widget->allocation.width - width) / 2; - y = (widget->allocation.height - height) / 2; + x = (allocation.width - width) / 2; + y = (allocation.height - height) / 2; cairo_move_to (cr, x, y); pango_cairo_show_layout (cr, layout); g_object_unref (layout); - cairo_destroy (cr); } } return FALSE; @@ -291,7 +291,7 @@ GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass); gtkwidget_class->button_press_event = ygtk_tree_view_button_press_event; gtkwidget_class->popup_menu = _ygtk_tree_view_popup_menu; - gtkwidget_class->expose_event = _ygtk_tree_view_expose_event; + gtkwidget_class->draw = _ygtk_tree_view_draw; GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = ygtk_tree_view_finalize; @@ -299,6 +299,6 @@ right_click_signal = g_signal_new ("right-click", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (YGtkTreeViewClass, right_click), - NULL, NULL, gtk_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); } Modified: trunk/gtk/src/ygtktreeview.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtktreeview.h?rev=64969&... ============================================================================== --- trunk/gtk/src/ygtktreeview.h (original) +++ trunk/gtk/src/ygtktreeview.h Sat Jul 23 07:43:30 2011 @@ -8,7 +8,7 @@ #ifndef YGTK_TREE_VIEW_H #define YGTK_TREE_VIEW_H -#include <gtk/gtktreeview.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define YGTK_TYPE_TREE_VIEW (ygtk_tree_view_get_type ()) Modified: trunk/gtk/src/ygtkwizard.c URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=64969&am... ============================================================================== --- trunk/gtk/src/ygtkwizard.c (original) +++ trunk/gtk/src/ygtkwizard.c Sat Jul 23 07:43:30 2011 @@ -21,8 +21,6 @@ #define YGI18N_C #include "YGi18n.h" -#define HELP_IMG_BG "yelp-icon-big" - // YGUtils bridge extern char *ygutils_mapKBAccel (const char *src); extern void ygutils_setWidgetFont (GtkWidget *widget, PangoStyle style, @@ -120,6 +118,7 @@ dialog->help_text = ygtk_html_wrap_new(); gtk_container_add (GTK_CONTAINER (dialog->help_box), dialog->help_text); +#if 0 // show a nice background image GtkIconTheme *theme = gtk_icon_theme_get_default(); GtkIconInfo *info = gtk_icon_theme_lookup_icon (theme, HELP_IMG_BG, 192, 0); if (info) { @@ -133,6 +132,7 @@ } gtk_icon_info_free (info); } +#endif // bottom part (search entry + close button) dialog->search_entry = gtk_entry_new(); @@ -149,7 +149,7 @@ G_CALLBACK (search_entry_activated_cb), dialog); dialog->close_button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); - GTK_WIDGET_SET_FLAGS (dialog->close_button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(dialog->close_button, TRUE); GtkWidget *close_box = gtk_hbutton_box_new(); gtk_container_add (GTK_CONTAINER (close_box), dialog->close_button); @@ -237,8 +237,8 @@ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); GtkBindingSet *binding_set = gtk_binding_set_by_class (klass); - gtk_binding_entry_add_signal (binding_set, GDK_F3, 0, "find_next", 0); - gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0, "close", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_F3, 0, "find_next", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0); } #ifdef SET_HELP_HISTORY @@ -323,7 +323,7 @@ #else if (help->text) g_free (help->text); - help->text = g_strdup (text); + help->text = g_strdup (text); #endif if (help->dialog) ygtk_help_text_sync (help, NULL); @@ -584,7 +584,7 @@ static GtkWidget *button_new (YGtkWizard *wizard) { GtkWidget *button = gtk_button_new_with_mnemonic (""); - GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(button, TRUE); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (button_clicked_cb), wizard); return button; @@ -647,7 +647,7 @@ GSList *buttons = gtk_size_group_get_widgets (group), *i; int max_width = 0, total = 0; for (i = buttons; i; i = i->next) { - if (!GTK_WIDGET_VISIBLE (i->data)) + if (!gtk_widget_get_visible (i->data)) continue; GtkRequisition req; gtk_widget_get_child_requisition ((GtkWidget *) i->data, &req); @@ -1201,6 +1201,6 @@ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); GtkBindingSet *binding_set = gtk_binding_set_by_class (klass); - gtk_binding_entry_add_signal (binding_set, GDK_F1, 0, "popup_help", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_F1, 0, "popup_help", 0); } Modified: trunk/gtk/src/ygtkwizard.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.h?rev=64969&am... ============================================================================== --- trunk/gtk/src/ygtkwizard.h (original) +++ trunk/gtk/src/ygtkwizard.h Sat Jul 23 07:43:30 2011 @@ -11,8 +11,8 @@ #define YGTK_WIZARD_H #include <gdk/gdk.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtkvbox.h> +#include <gtk/gtk.h> + G_BEGIN_DECLS // test feature: history on help dialog -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org