diff options
Diffstat (limited to 'cut-n-paste')
-rw-r--r-- | cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c | 146 | ||||
-rw-r--r-- | cut-n-paste/smclient/eggsmclient-xsmp.c | 19 | ||||
-rw-r--r-- | cut-n-paste/toolbar-editor/egg-editable-toolbar.c | 72 | ||||
-rw-r--r-- | cut-n-paste/toolbar-editor/egg-editable-toolbar.h | 2 | ||||
-rw-r--r-- | cut-n-paste/toolbar-editor/egg-toolbar-editor.c | 101 | ||||
-rw-r--r-- | cut-n-paste/zoom-control/ephy-zoom-control.c | 4 |
6 files changed, 21 insertions, 323 deletions
diff --git a/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c b/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c index e880b637..0addfa72 100644 --- a/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c +++ b/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c @@ -25,17 +25,8 @@ #include "gimpwidgetsmarshal.h" #include "gimpcellrenderertoggle.h" - #define DEFAULT_ICON_SIZE GTK_ICON_SIZE_BUTTON -#if GTK_CHECK_VERSION (3, 0, 0) -#define GTK_STATE_INSENSITIVE GTK_STATE_FLAG_INSENSITIVE -#define GTK_STATE_SELECTED GTK_STATE_FLAG_SELECTED -#define GTK_STATE_ACTIVE GTK_STATE_FLAG_ACTIVE -#define GTK_STATE_NORMAL 0 -#define gtk_widget_render_icon(A,B,C,D) gtk_widget_render_icon_pixbuf(A,B,C) -#endif - enum { CLICKED, @@ -61,42 +52,23 @@ static void gimp_cell_renderer_toggle_set_property (GObject *object, GParamSpec *pspec); static void gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *rectangle, -#else - GdkRectangle *rectangle, -#endif gint *x_offset, gint *y_offset, gint *width, gint *height); static void gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, -#if GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr, -#else - GdkWindow *window, -#endif GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *background_area, const GdkRectangle *cell_area, -#else - GdkRectangle *background_area, - GdkRectangle *cell_area, - GdkRectangle *expose_area, -#endif GtkCellRendererState flags); static gboolean gimp_cell_renderer_toggle_activate (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *background_area, const GdkRectangle *cell_area, -#else - GdkRectangle *background_area, - GdkRectangle *cell_area, -#endif GtkCellRendererState flags); static void gimp_cell_renderer_toggle_create_pixbuf (GimpCellRendererToggle *toggle, GtkWidget *widget); @@ -234,23 +206,15 @@ gimp_cell_renderer_toggle_set_property (GObject *object, static void gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *cell_area, -#else - GdkRectangle *cell_area, -#endif gint *x_offset, gint *y_offset, gint *width, gint *height) { GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell); -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context = gtk_widget_get_style_context (widget); GtkBorder border; -#else - GtkStyle *style = gtk_widget_get_style (widget); -#endif gint calc_width; gint calc_height; gint pixbuf_width; @@ -273,9 +237,7 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, gtk_cell_renderer_get_alignment (cell, &xalign, &yalign); gtk_cell_renderer_get_padding (cell, &xpad, &ypad); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_get_border (context, 0, &border); -#endif if (! toggle->pixbuf) gimp_cell_renderer_toggle_create_pixbuf (toggle, widget); @@ -283,15 +245,8 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, pixbuf_width = gdk_pixbuf_get_width (toggle->pixbuf); pixbuf_height = gdk_pixbuf_get_height (toggle->pixbuf); -#if GTK_CHECK_VERSION (3, 0, 0) calc_width = (pixbuf_width + (gint) xpad * 2 + (border.left + border.right)); calc_height = (pixbuf_height + (gint) ypad * 2 + (border.top + border.bottom)); -#else - calc_width = (pixbuf_width + - (gint) xpad * 2 + style->xthickness * 2); - calc_height = (pixbuf_height + - (gint) ypad * 2 + style->ythickness * 2); -#endif if (width) *width = calc_width; @@ -317,39 +272,20 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, } } -#if GTK_CHECK_VERSION (3, 0, 0) -#define gimp_cell_renderer_toggle_get_size gtk_cell_renderer_get_size -#endif - static void gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, -#if GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr, -#else - GdkWindow *window, -#endif GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *background_area, const GdkRectangle *cell_area, -#else - GdkRectangle *background_area, - GdkRectangle *cell_area, - GdkRectangle *expose_area, -#endif GtkCellRendererState flags) { GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell); GdkRectangle toggle_rect; GdkRectangle draw_rect; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context = gtk_widget_get_style_context (widget); GdkRectangle clip_rect; GtkStateFlags state; -#else - GtkStyle *style = gtk_widget_get_style (widget); - GtkStateType state; -#endif gboolean active; gint xpad; gint ypad; @@ -357,26 +293,19 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, if (! toggle->stock_id) { GTK_CELL_RENDERER_CLASS (parent_class)->render (cell, -#if GTK_CHECK_VERSION (3, 0, 0) cr, -#else - window, -#endif widget, background_area, cell_area, -#if !GTK_CHECK_VERSION (3, 0, 0) - expose_area, -#endif flags); return; } - gimp_cell_renderer_toggle_get_size (cell, widget, cell_area, - &toggle_rect.x, - &toggle_rect.y, - &toggle_rect.width, - &toggle_rect.height); + gtk_cell_renderer_get_size (cell, widget, cell_area, + &toggle_rect.x, + &toggle_rect.y, + &toggle_rect.width, + &toggle_rect.height); gtk_cell_renderer_get_padding (cell, &xpad, &ypad); toggle_rect.x += cell_area->x + xpad; @@ -392,24 +321,23 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, if (!gtk_cell_renderer_get_sensitive (cell)) { - state = GTK_STATE_INSENSITIVE; + state = GTK_STATE_FLAG_INSENSITIVE; } else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED) { if (gtk_widget_has_focus (widget)) - state = GTK_STATE_SELECTED; + state = GTK_STATE_FLAG_SELECTED; else - state = GTK_STATE_ACTIVE; + state = GTK_STATE_FLAG_ACTIVE; } else { if (gtk_cell_renderer_toggle_get_activatable (GTK_CELL_RENDERER_TOGGLE (cell))) - state = GTK_STATE_NORMAL; + state = GTK_STATE_FLAG_NORMAL; else - state = GTK_STATE_INSENSITIVE; + state = GTK_STATE_FLAG_INSENSITIVE; } -#if GTK_CHECK_VERSION (3, 0, 0) if ((flags & GTK_CELL_RENDERER_PRELIT) && gdk_cairo_get_clip_rectangle(cr, &clip_rect) && gdk_rectangle_intersect (&clip_rect, cell_area, &draw_rect)) @@ -424,25 +352,12 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, gtk_style_context_restore (context); cairo_restore (cr); } -#else - if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) && - (flags & GTK_CELL_RENDERER_PRELIT)) - gtk_paint_shadow (style, - window, - state, - active ? GTK_SHADOW_IN : GTK_SHADOW_OUT, - &draw_rect, - widget, NULL, - toggle_rect.x, toggle_rect.y, - toggle_rect.width, toggle_rect.height); -#endif if (active) { GdkPixbuf *insensitive = NULL; GdkPixbuf *pixbuf = toggle->pixbuf; -#if GTK_CHECK_VERSION (3, 0, 0) GtkBorder border = { 1, 1, 1, 1 }; #if 0 @@ -459,14 +374,6 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, toggle_rect.height -= (border.top + border.bottom); if (state & GTK_STATE_FLAG_INSENSITIVE) -#else - toggle_rect.x += style->xthickness; - toggle_rect.y += style->ythickness; - toggle_rect.width -= style->xthickness * 2; - toggle_rect.height -= style->ythickness * 2; - - if (state == GTK_STATE_INSENSITIVE) -#endif { GtkIconSource *source; @@ -479,21 +386,10 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_icon_source_set_size_wildcarded (source, FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_save (context); gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE); insensitive = gtk_render_icon_pixbuf (context, source, (GtkIconSize)-1); gtk_style_context_restore (context); -#else - insensitive = gtk_style_render_icon (gtk_widget_get_style (widget), - source, - gtk_widget_get_direction (widget), - GTK_STATE_INSENSITIVE, - /* arbitrary */ - (GtkIconSize)-1, - widget, - "gimpcellrenderertoggle"); -#endif gtk_icon_source_free (source); @@ -502,19 +398,9 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, if (gdk_rectangle_intersect (&draw_rect, &toggle_rect, &draw_rect)) { -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_t *cr; - - cr = gdk_cairo_create (window); -#endif - gdk_cairo_set_source_pixbuf (cr, pixbuf, toggle_rect.x, toggle_rect.y); gdk_cairo_rectangle (cr, &draw_rect); cairo_fill (cr); - -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif } if (insensitive) @@ -527,13 +413,8 @@ gimp_cell_renderer_toggle_activate (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *background_area, const GdkRectangle *cell_area, -#else - GdkRectangle *background_area, - GdkRectangle *cell_area, -#endif GtkCellRendererState flags) { GtkCellRendererToggle *toggle = GTK_CELL_RENDERER_TOGGLE (cell); @@ -565,12 +446,11 @@ gimp_cell_renderer_toggle_create_pixbuf (GimpCellRendererToggle *toggle, if (toggle->pixbuf) g_object_unref (toggle->pixbuf); - toggle->pixbuf = gtk_widget_render_icon (widget, - toggle->stock_id, - toggle->stock_size, NULL); + toggle->pixbuf = gtk_widget_render_icon_pixbuf (widget, + toggle->stock_id, + toggle->stock_size); } - /** * gimp_cell_renderer_toggle_new: * @stock_id: the stock_id of the icon to use for the active state diff --git a/cut-n-paste/smclient/eggsmclient-xsmp.c b/cut-n-paste/smclient/eggsmclient-xsmp.c index cf30f932..49f7296f 100644 --- a/cut-n-paste/smclient/eggsmclient-xsmp.c +++ b/cut-n-paste/smclient/eggsmclient-xsmp.c @@ -368,13 +368,7 @@ sm_client_xsmp_startup (EggSMClient *client, xsmp->client_id = g_strdup (ret_client_id); free (ret_client_id); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_enter (); -#endif gdk_x11_set_sm_client_id (xsmp->client_id); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif g_debug ("Got client ID \"%s\"", xsmp->client_id); } @@ -542,10 +536,6 @@ idle_do_pending_events (gpointer data) EggSMClientXSMP *xsmp = data; EggSMClient *client = data; -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_enter (); -#endif - xsmp->idle = 0; if (xsmp->waiting_to_emit_quit) @@ -569,9 +559,6 @@ idle_do_pending_events (gpointer data) } out: -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif return FALSE; } @@ -1293,13 +1280,7 @@ process_ice_messages (IceConn ice_conn) { IceProcessMessagesStatus status; -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_enter (); -#endif status = IceProcessMessages (ice_conn, NULL, NULL); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif switch (status) { diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c index f92fd117..4885fc37 100644 --- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c +++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c @@ -35,12 +35,6 @@ static GdkPixbuf * new_separator_pixbuf (void); #define EGG_ITEM_NAME "egg-item-name" #define STOCK_DRAG_MODE "stock_drag-mode" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gdk_cursor_unref g_object_unref -#define gtk_widget_render_icon(A,B,C,D) gtk_widget_render_icon_pixbuf(A,B,C) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - static const GtkTargetEntry dest_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, }; @@ -86,10 +80,8 @@ struct _EggEditableToolbarPrivate GtkToolbar *dnd_toolbar; GtkToolItem *dnd_toolitem; -#if GTK_CHECK_VERSION (3, 0, 0) gboolean set_primary_class; gchar *primary_name; -#endif }; G_DEFINE_TYPE (EggEditableToolbar, egg_editable_toolbar, GTK_TYPE_BOX); @@ -296,7 +288,6 @@ move_item_cb (GtkAction *action, GtkTargetList *list = gtk_target_list_new (dest_drag_types, G_N_ELEMENTS (dest_drag_types)); GdkEvent *realevent = gtk_get_current_event(); -#if GTK_CHECK_VERSION (3, 0, 0) GdkEvent *event = gdk_event_new (GDK_MOTION_NOTIFY); event->motion.window = g_object_ref (realevent->any.window); event->motion.send_event = FALSE; @@ -309,19 +300,6 @@ move_item_cb (GtkAction *action, gtk_drag_begin (toolitem, list, GDK_ACTION_MOVE, 1, event); gdk_event_free (event); -#else - GdkEventMotion event; - event.type = GDK_MOTION_NOTIFY; - event.window = realevent->any.window; - event.send_event = FALSE; - event.axes = NULL; - event.time = gdk_event_get_time (realevent); - gdk_event_get_state (realevent, &event.state); - gdk_event_get_coords (realevent, &event.x, &event.y); - gdk_event_get_root_coords (realevent, &event.x_root, &event.y_root); - - gtk_drag_begin (toolitem, list, GDK_ACTION_MOVE, 1, (GdkEvent *)&event); -#endif gtk_target_list_unref (list); } @@ -390,7 +368,6 @@ popup_context_menu_cb (GtkWidget *toolbar, } } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean edit_mode_button_press_event_cb (GtkWidget *widget, GdkEventButton *event, @@ -402,7 +379,6 @@ edit_mode_button_press_event_cb (GtkWidget *widget, } return FALSE; } -#endif static gboolean button_press_event_cb (GtkWidget *widget, @@ -450,7 +426,6 @@ configure_item_sensitivity (GtkToolItem *item, EggEditableToolbar *etoolbar) } -#if GTK_CHECK_VERSION (3, 0, 0) static void configure_item_window_drag (GtkToolItem *item, EggEditableToolbar *etoolbar) @@ -467,7 +442,6 @@ configure_item_window_drag (GtkToolItem *item, NULL); } } -#endif static void configure_item_cursor (GtkToolItem *item, @@ -490,7 +464,7 @@ configure_item_cursor (GtkToolItem *item, cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen), GDK_HAND2); gdk_window_set_cursor (window, cursor); - gdk_cursor_unref (cursor); + g_object_unref (cursor); gtk_drag_source_set (widget, GDK_BUTTON1_MASK, dest_drag_types, G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE); @@ -538,8 +512,8 @@ configure_item_cursor (GtkToolItem *item, } else if (stock_id) { - pixbuf = gtk_widget_render_icon (widget, stock_id, - GTK_ICON_SIZE_LARGE_TOOLBAR, NULL); + pixbuf = gtk_widget_render_icon_pixbuf (widget, stock_id, + GTK_ICON_SIZE_LARGE_TOOLBAR); } g_free (icon_name); g_free (stock_id); @@ -555,11 +529,7 @@ configure_item_cursor (GtkToolItem *item, } else { -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_cursor (window, NULL); -#else - gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(item)), NULL); -#endif } } } @@ -620,16 +590,11 @@ action_sensitive_cb (GtkAction *action, { EggEditableToolbar *etoolbar; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *ancestor = gtk_widget_get_ancestor (GTK_WIDGET (item), EGG_TYPE_EDITABLE_TOOLBAR); if (!ancestor) return; etoolbar = EGG_EDITABLE_TOOLBAR (ancestor); -#else - etoolbar = EGG_EDITABLE_TOOLBAR - (gtk_widget_get_ancestor (GTK_WIDGET (item), EGG_TYPE_EDITABLE_TOOLBAR)); -#endif if (etoolbar->priv->edit_mode > 0) { @@ -648,9 +613,7 @@ create_item_from_action (EggEditableToolbar *etoolbar, if (strcmp (name, "_separator") == 0) { item = gtk_separator_tool_item_new (); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_show (GTK_WIDGET (item)); -#endif } else { @@ -669,10 +632,6 @@ create_item_from_action (EggEditableToolbar *etoolbar, G_CALLBACK (action_sensitive_cb), item, 0); } -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_show (GTK_WIDGET (item)); -#endif - g_object_set_data_full (G_OBJECT (item), EGG_ITEM_NAME, g_strdup (name), g_free); @@ -927,12 +886,10 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar) char action_name[40]; char *action_label; char *tmp; -#if GTK_CHECK_VERSION (3, 0, 0) gboolean primary_class_set; GtkStyleContext *context; const gchar *toolbar_name; gboolean visible; -#endif if (priv == NULL || priv->model == NULL || priv->manager == NULL || priv->visibility_paths == NULL || priv->actions == NULL) @@ -954,15 +911,11 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar) showing = gtk_widget_get_visible (GTK_WIDGET (etoolbar)); -#if GTK_CHECK_VERSION (3, 0, 0) primary_class_set = !priv->set_primary_class; -#endif n_toolbars = egg_toolbars_model_n_toolbars (priv->model); for (i = 0; i < n_toolbars; i++) { -#if GTK_CHECK_VERSION (3, 0, 0) toolbar_name = egg_toolbars_model_toolbar_nth (priv->model, i); -#endif string = g_string_sized_new (0); n_items = egg_toolbars_model_n_items (priv->model, i); for (k = 0, j = 0; j < n_items; j++) @@ -1041,7 +994,6 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar) & EGG_TB_MODEL_NOT_REMOVABLE) == 0); gtk_action_set_sensitive (GTK_ACTION (action), showing); -#if GTK_CHECK_VERSION (3, 0, 0) visible = gtk_widget_get_visible (get_dock_nth (etoolbar, i)); gtk_toggle_action_set_active (action, visible); @@ -1063,10 +1015,6 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar) } gtk_widget_reset_style (get_toolbar_nth (etoolbar, i)); -#else - gtk_toggle_action_set_active (action, gtk_widget_get_visible - (get_dock_nth (etoolbar, i))); -#endif for (list = priv->visibility_paths; list != NULL; list = g_list_next (list)) { @@ -1094,7 +1042,7 @@ create_dock (EggEditableToolbar *etoolbar) { GtkWidget *toolbar, *hbox; - hbox = gtk_hbox_new (0, FALSE); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); toolbar = gtk_toolbar_new (); gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE); @@ -1278,9 +1226,7 @@ item_added_cb (EggToolbarsModel *model, connect_widget_signals (GTK_WIDGET (item), etoolbar); configure_item_tooltip (item); configure_item_cursor (item, etoolbar); -#if GTK_CHECK_VERSION (3, 0, 0) configure_item_window_drag (item, etoolbar); -#endif configure_item_sensitivity (item, etoolbar); dock = get_dock_nth (etoolbar, tpos); @@ -1483,10 +1429,8 @@ egg_editable_toolbar_dispose (GObject *object) g_free (priv->popup_path); priv->popup_path = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) g_free (priv->primary_name); priv->primary_name = NULL; -#endif if (priv->manager != NULL) { @@ -1614,9 +1558,7 @@ set_edit_mode (EggEditableToolbar *etoolbar, item = gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), l); configure_item_cursor (item, etoolbar); -#if GTK_CHECK_VERSION (3, 0, 0) configure_item_window_drag (item, etoolbar); -#endif configure_item_sensitivity (item, etoolbar); } } @@ -1900,11 +1842,7 @@ new_separator_pixbuf (void) GtkWidget *separator; GdkPixbuf *pixbuf; -#if GTK_CHECK_VERSION(3, 0, 0) separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL); -#else - separator = gtk_vseparator_new (); -#endif pixbuf = new_pixbuf_from_widget (separator); return pixbuf; } @@ -1950,7 +1888,6 @@ egg_editable_toolbar_get_model (EggEditableToolbar *etoolbar) return etoolbar->priv->model; } -#if GTK_CHECK_VERSION(3, 0, 0) /** * egg_editable_toolbar_get_manager: * @@ -1974,4 +1911,3 @@ egg_editable_toolbar_set_primary_class (EggEditableToolbar *etoolbar, toolbar_visibility_refresh (etoolbar); } -#endif diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.h b/cut-n-paste/toolbar-editor/egg-editable-toolbar.h index a6d06f34..cd589661 100644 --- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.h +++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.h @@ -81,11 +81,9 @@ void egg_editable_toolbar_set_selected (EggEditableToolbar * void egg_editable_toolbar_add_visibility (EggEditableToolbar *etoolbar, const char *path); -#if GTK_CHECK_VERSION(3, 0, 0) void egg_editable_toolbar_set_primary_class (EggEditableToolbar *etoolbar, gboolean set, const gchar *path); -#endif /* Private Functions */ diff --git a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c index 328b0327..fa79318b 100644 --- a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c +++ b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c @@ -28,12 +28,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#if GTK_CHECK_VERSION (3, 0, 0) -#define gdk_cursor_unref g_object_unref -#define gtk_widget_render_icon(A,B,C,D) gtk_widget_render_icon_pixbuf(A,B,C) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - static const GtkTargetEntry dest_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, }; @@ -68,11 +62,7 @@ struct EggToolbarEditorPrivate GtkUIManager *manager; EggToolbarsModel *model; -#if GTK_CHECK_VERSION(3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *scrolled_window; GList *actions_list; GList *factory_list; @@ -379,7 +369,7 @@ set_drag_cursor (GtkWidget *widget) cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen), GDK_HAND2); gdk_window_set_cursor (gtk_widget_get_window (widget), cursor); - gdk_cursor_unref (cursor); + g_object_unref (cursor); } static void @@ -396,8 +386,8 @@ event_box_realize_cb (GtkWidget *widget, GtkImage *icon) GdkPixbuf *pixbuf; gtk_image_get_stock (icon, &stock_id, NULL); - pixbuf = gtk_widget_render_icon (widget, stock_id, - GTK_ICON_SIZE_LARGE_TOOLBAR, NULL); + pixbuf = gtk_widget_render_icon_pixbuf (widget, stock_id, + GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_drag_source_set_icon_pixbuf (widget, pixbuf); g_object_unref (pixbuf); } @@ -468,7 +458,7 @@ editor_create_item (EggToolbarEditor *editor, G_CALLBACK (drag_end_cb), NULL); } - vbox = gtk_vbox_new (0, FALSE); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (event_box), vbox); @@ -545,7 +535,6 @@ editor_create_item_from_name (EggToolbarEditor *editor, return item; } -#if GTK_CHECK_VERSION(3, 0, 0) static gint append_grid (GtkGrid *grid, GList *items, gint y, gint width) { @@ -590,52 +579,6 @@ append_grid (GtkGrid *grid, GList *items, gint y, gint width) } return y; } -#else -static gint -append_table (GtkTable *table, GList *items, gint y, gint width) -{ - if (items != NULL) - { - gint x = 0, height; - GtkWidget *alignment; - GtkWidget *item; - - height = g_list_length (items) / width + 1; - gtk_table_resize (table, height, width); - - if (y > 0) - { - item = gtk_hseparator_new (); - alignment = gtk_alignment_new (0.5, 0.5, 1.0, 0.0); - gtk_container_add (GTK_CONTAINER (alignment), item); - gtk_widget_show (alignment); - gtk_widget_show (item); - - gtk_table_attach_defaults (table, alignment, 0, width, y-1, y+1); - } - - for (; items != NULL; items = items->next) - { - item = items->data; - alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (alignment), item); - gtk_widget_show (alignment); - gtk_widget_show (item); - - if (x >= width) - { - x = 0; - y++; - } - gtk_table_attach_defaults (table, alignment, x, x+1, y, y+1); - x++; - } - - y++; - } - return y; -} -#endif static void update_editor_sheet (EggToolbarEditor *editor) @@ -643,7 +586,6 @@ update_editor_sheet (EggToolbarEditor *editor) gint y; GPtrArray *items; GList *to_move = NULL, *to_copy = NULL; -#if GTK_CHECK_VERSION(3, 0, 0) GtkWidget *grid; GtkWidget *viewport; @@ -656,20 +598,6 @@ update_editor_sheet (EggToolbarEditor *editor) gtk_grid_set_row_spacing (GTK_GRID (grid), 24); gtk_widget_show (grid); gtk_drag_dest_set (grid, GTK_DEST_DEFAULT_ALL, -#else - GtkWidget *table; - GtkWidget *viewport; - - g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor)); - - /* Create new table. */ - table = gtk_table_new (0, 0, TRUE); - editor->priv->table = table; - gtk_container_set_border_width (GTK_CONTAINER (table), 12); - gtk_table_set_row_spacings (GTK_TABLE (table), 24); - gtk_widget_show (table); - gtk_drag_dest_set (table, GTK_DEST_DEFAULT_ALL, -#endif dest_drag_types, G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE | GDK_ACTION_COPY); @@ -701,7 +629,6 @@ update_editor_sheet (EggToolbarEditor *editor) /* Add them to the sheet. */ y = 0; -#if GTK_CHECK_VERSION(3, 0, 0) y = append_grid (GTK_GRID (grid), to_move, y, 4); y = append_grid (GTK_GRID (grid), to_copy, y, 4); @@ -720,26 +647,6 @@ update_editor_sheet (EggToolbarEditor *editor) /* Add grid to window. */ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), grid); -#else - y = append_table (GTK_TABLE (table), to_move, y, 4); - y = append_table (GTK_TABLE (table), to_copy, y, 4); - - g_list_free (to_move); - g_list_free (to_copy); - g_ptr_array_free (items, TRUE); - - /* Delete old table. */ - viewport = gtk_bin_get_child (GTK_BIN (editor->priv->scrolled_window)); - if (viewport) - { - gtk_container_remove (GTK_CONTAINER (viewport), - gtk_bin_get_child (GTK_BIN (viewport))); - } - - /* Add table to window. */ - gtk_scrolled_window_add_with_viewport - (GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), table); -#endif } static void diff --git a/cut-n-paste/zoom-control/ephy-zoom-control.c b/cut-n-paste/zoom-control/ephy-zoom-control.c index ed5dc52e..a581e878 100644 --- a/cut-n-paste/zoom-control/ephy-zoom-control.c +++ b/cut-n-paste/zoom-control/ephy-zoom-control.c @@ -200,12 +200,8 @@ ephy_zoom_control_init (EphyZoomControl *control) i = ephy_zoom_get_zoom_level_index (p->zoom); gtk_combo_box_set_active (p->combo, i); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_set_homogeneous (GTK_BOX (vbox), TRUE); -#else - vbox = gtk_vbox_new (TRUE, 0); -#endif gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (p->combo), TRUE, FALSE, 0); gtk_widget_show (vbox); |