From ea302a83da329d7f182724fb0c9d1a4d22aa9362 Mon Sep 17 00:00:00 2001 From: monsta Date: Thu, 26 May 2016 16:14:26 +0300 Subject: [PATCH] drop old GTK+2 code --- src/eggsmclient-private.h | 4 - src/eggsmclient-xsmp.c | 21 ----- src/profile-editor.c | 15 ---- src/terminal-info-bar.c | 4 - src/terminal-screen-container.c | 4 - src/terminal-util.c | 4 - src/terminal-window.c | 147 +++----------------------------- 7 files changed, 14 insertions(+), 185 deletions(-) diff --git a/src/eggsmclient-private.h b/src/eggsmclient-private.h index ed47397..0beca30 100644 --- a/src/eggsmclient-private.h +++ b/src/eggsmclient-private.h @@ -20,10 +20,6 @@ #ifndef __EGG_SM_CLIENT_PRIVATE_H__ #define __EGG_SM_CLIENT_PRIVATE_H__ -#include -#if !GTK_CHECK_VERSION (3, 0, 0) -#include -#endif #include "eggsmclient.h" G_BEGIN_DECLS diff --git a/src/eggsmclient-xsmp.c b/src/eggsmclient-xsmp.c index f278ded..0b0b960 100644 --- a/src/eggsmclient-xsmp.c +++ b/src/eggsmclient-xsmp.c @@ -36,9 +36,7 @@ #include #include -#if GTK_CHECK_VERSION (3, 0, 0) #include -#endif #define EGG_TYPE_SM_CLIENT_XSMP (egg_sm_client_xsmp_get_type ()) #define EGG_SM_CLIENT_XSMP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP)) @@ -376,13 +374,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_x11_set_sm_client_id (xsmp->client_id); -#else - gdk_threads_enter (); - gdk_set_sm_client_id (xsmp->client_id); - gdk_threads_leave (); -#endif g_debug ("Got client ID \"%s\"", xsmp->client_id); } @@ -568,10 +560,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) @@ -595,9 +583,6 @@ idle_do_pending_events (gpointer data) } out: -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif return FALSE; } @@ -1330,13 +1315,7 @@ process_ice_messages (IceConn ice_conn) { IceProcessMessagesStatus status; -#if GTK_CHECK_VERSION (3, 0, 0) status = IceProcessMessages (ice_conn, NULL, NULL); -#else - gdk_threads_enter (); - status = IceProcessMessages (ice_conn, NULL, NULL); - gdk_threads_leave (); -#endif switch (status) { diff --git a/src/profile-editor.c b/src/profile-editor.c index 873dd11..f20afe7 100644 --- a/src/profile-editor.c +++ b/src/profile-editor.c @@ -546,8 +546,6 @@ reset_compat_defaults_cb (GtkWidget *button, static void init_color_scheme_menu (GtkWidget *combo_box) { - #if GTK_CHECK_VERSION(3, 0, 0) - GtkCellRenderer *renderer; GtkTreeIter iter; GtkListStore *store; @@ -569,19 +567,6 @@ init_color_scheme_menu (GtkWidget *combo_box) /*FIXME, avoid double loading of color schemes names from UI file */ /* gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer, "text", 0, NULL);*/ - - #else - - int i; - - i = G_N_ELEMENTS (color_schemes); - while (i > 0) - { - gtk_combo_box_prepend_text (GTK_COMBO_BOX (combo_box), - _(color_schemes[--i].name)); - } - - #endif } static char* diff --git a/src/terminal-info-bar.c b/src/terminal-info-bar.c index e382783..40a6e72 100644 --- a/src/terminal-info-bar.c +++ b/src/terminal-info-bar.c @@ -41,11 +41,7 @@ terminal_info_bar_init (TerminalInfoBar *bar) priv = bar->priv = TERMINAL_INFO_BAR_GET_PRIVATE (bar); -#if GTK_CHECK_VERSION (3, 0, 0) priv->content_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - priv->content_box = gtk_vbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (info_bar)), priv->content_box, TRUE, TRUE, 0); } diff --git a/src/terminal-screen-container.c b/src/terminal-screen-container.c index 290685c..52432e5 100644 --- a/src/terminal-screen-container.c +++ b/src/terminal-screen-container.c @@ -167,11 +167,7 @@ terminal_screen_container_constructor (GType type, #else -#if GTK_CHECK_VERSION (3, 0, 0) priv->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - priv->hbox = gtk_hbox_new (FALSE, 0); -#endif #if VTE_CHECK_VERSION (0, 38, 0) priv->vscrollbar = gtk_vscrollbar_new (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (priv->screen))); diff --git a/src/terminal-util.c b/src/terminal-util.c index cc14584..f8c5254 100644 --- a/src/terminal-util.c +++ b/src/terminal-util.c @@ -43,10 +43,6 @@ #include "terminal-util.h" #include "terminal-window.h" -#if !GTK_CHECK_VERSION(3, 0, 0) - #define gdk_error_trap_pop_ignored gdk_error_trap_pop -#endif - void terminal_util_set_unique_role (GtkWindow *window, const char *prefix) { diff --git a/src/terminal-window.c b/src/terminal-window.c index 69f3063..89566b6 100644 --- a/src/terminal-window.c +++ b/src/terminal-window.c @@ -22,6 +22,7 @@ #include #include #include +#include #ifdef GDK_WINDOWING_X11 #include #endif @@ -43,10 +44,6 @@ #include "skey-popup.h" #endif -#if GTK_CHECK_VERSION(3, 0, 0) -#include -#endif - struct _TerminalWindowPrivate { GtkActionGroup *action_group; @@ -395,13 +392,8 @@ position_menu_under_widget (GtkMenu *menu, gtk_widget_get_allocation (widget, &widget_allocation); container = gtk_widget_get_ancestor (widget, GTK_TYPE_CONTAINER); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (widget, &req, NULL); gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_req, NULL); -#else - gtk_widget_size_request (widget, &req); - gtk_widget_size_request (GTK_WIDGET (menu), &menu_req); -#endif screen = gtk_widget_get_screen (GTK_WIDGET (menu)); monitor_num = gdk_screen_get_monitor_at_window (screen, widget_window); @@ -1542,42 +1534,23 @@ terminal_window_realize (GtkWidget *widget) #if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND) GdkScreen *screen; GtkAllocation widget_allocation; - #if GTK_CHECK_VERSION (3, 0, 0) - GdkVisual *visual; - #else - GdkColormap *colormap; - #endif + GdkVisual *visual; + gtk_widget_get_allocation (widget, &widget_allocation); screen = gtk_widget_get_screen (GTK_WIDGET (window)); - #if GTK_CHECK_VERSION (3, 0, 0) - if (gdk_screen_is_composited (screen) && - (visual = gdk_screen_get_rgba_visual (screen)) != NULL) - { + if (gdk_screen_is_composited (screen) && + (visual = gdk_screen_get_rgba_visual (screen)) != NULL) + { /* Set RGBA visual if possible so VTE can use real transparency */ - gtk_widget_set_visual (GTK_WIDGET (widget), visual); - priv->have_argb_visual = TRUE; - } - else - { - gtk_widget_set_visual (GTK_WIDGET (window), gdk_screen_get_system_visual (screen)); - priv->have_argb_visual = FALSE; - } - #else - if (gdk_screen_is_composited (screen) && - (colormap = gdk_screen_get_rgba_colormap (screen)) != NULL) - { - /* Set RGBA colormap if possible so VTE can use real transparency */ - gtk_widget_set_colormap (widget, colormap); - priv->have_argb_visual = TRUE; - } - else - { - gtk_widget_set_colormap (widget, gdk_screen_get_default_colormap (screen)); - priv->have_argb_visual = FALSE; - } - #endif - + gtk_widget_set_visual (GTK_WIDGET (widget), visual); + priv->have_argb_visual = TRUE; + } + else + { + gtk_widget_set_visual (GTK_WIDGET (window), gdk_screen_get_system_visual (screen)); + priv->have_argb_visual = FALSE; + } #endif _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, @@ -1678,11 +1651,7 @@ terminal_window_screen_update (TerminalWindow *window, TerminalApp *app; #ifdef GDK_WINDOWING_X11 -#if GTK_CHECK_VERSION (3, 0, 0) if (screen && GDK_IS_X11_SCREEN (screen)) -#else - if (screen) -#endif { terminal_window_window_manager_changed_cb (screen, window); g_signal_connect (screen, "window-manager-changed", @@ -1722,11 +1691,7 @@ terminal_window_screen_changed (GtkWidget *widget, return; #ifdef GDK_WINDOWING_X11 -#if GTK_CHECK_VERSION (3, 0, 0) if (previous_screen && GDK_IS_X11_SCREEN (previous_screen)) -#else - if (previous_screen) -#endif { g_signal_handlers_disconnect_by_func (previous_screen, G_CALLBACK (terminal_window_window_manager_changed_cb), @@ -2086,23 +2051,17 @@ terminal_window_init (TerminalWindow *window) } #endif -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (window)); gtk_style_context_add_class (context, "mate-terminal"); -#endif gtk_window_set_title (GTK_WINDOW (window), _("Terminal")); priv->active_screen = NULL; priv->menubar_visible = FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - main_vbox = gtk_vbox_new (FALSE, 0); -#endif gtk_container_add (GTK_CONTAINER (window), main_vbox); gtk_widget_show (main_vbox); @@ -2283,11 +2242,7 @@ terminal_window_dispose (GObject *object) #ifdef GDK_WINDOWING_X11 screen = gtk_widget_get_screen (GTK_WIDGET (object)); -#if GTK_CHECK_VERSION (3, 0, 0) if (screen && GDK_IS_X11_SCREEN (screen)) -#else - if (screen) -#endif { g_signal_handlers_disconnect_by_func (screen, G_CALLBACK (terminal_window_window_manager_changed_cb), @@ -2671,15 +2626,6 @@ terminal_window_set_size_force_grid (TerminalWindow *window, GtkWidget *app; int grid_width; int grid_height; -#if !GTK_CHECK_VERSION (3, 0, 0) - /* Owen's hack from gnome-terminal */ - GtkRequisition toplevel_request; - GtkRequisition widget_request; - int w, h; - int char_width; - int char_height; - GtkBorder *inner_border = NULL; -#endif /* be sure our geometry is up-to-date */ terminal_window_update_geometry (window); @@ -2689,7 +2635,6 @@ terminal_window_set_size_force_grid (TerminalWindow *window, app = gtk_widget_get_toplevel (widget); g_assert (app != NULL); -#if GTK_CHECK_VERSION (3, 0, 0) terminal_screen_get_size (screen, &grid_width, &grid_height); if (force_grid_width >= 0) @@ -2700,47 +2645,6 @@ terminal_window_set_size_force_grid (TerminalWindow *window, gtk_window_resize_to_geometry (GTK_WINDOW (app), grid_width, grid_height); else gtk_window_set_default_geometry (GTK_WINDOW (app), grid_width, grid_height); -#else - gtk_widget_size_request (app, &toplevel_request); - gtk_widget_size_request (widget, &widget_request); - - terminal_screen_get_cell_size (screen, &char_width, &char_height); - terminal_screen_get_size (screen, &grid_width, &grid_height); - - _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, - "[window %p] set size: toplevel %dx%d widget %dx%d grid %dx%d char-cell %dx%d\n", - window, - toplevel_request.width, toplevel_request.height, - widget_request.width, widget_request.height, - grid_width, grid_height, char_width, char_height); - - w = toplevel_request.width - widget_request.width; - h = toplevel_request.height - widget_request.height; - - if (force_grid_width >= 0) - grid_width = force_grid_width; - if (force_grid_height >= 0) - grid_height = force_grid_height; - - gtk_widget_style_get (widget, "inner-border", &inner_border, NULL); - w += (inner_border ? (inner_border->left + inner_border->right) : 0) + char_width * grid_width; - h += (inner_border ? (inner_border->top + inner_border->bottom) : 0) + char_height * grid_height; - gtk_border_free (inner_border); - - _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, - "[window %p] set size: grid %dx%d force %dx%d setting %dx%d pixels\n", - window, - grid_width, grid_height, force_grid_width, force_grid_height, w, h); - - if (even_if_mapped && gtk_widget_get_mapped (app)) - { - gtk_window_resize (GTK_WINDOW (app), w, h); - } - else - { - gtk_window_set_default_size (GTK_WINDOW (app), w, h); - } -#endif } void @@ -3060,11 +2964,7 @@ terminal_window_update_geometry (TerminalWindow *window) TerminalWindowPrivate *priv = window->priv; GtkWidget *widget; GdkGeometry hints; -#if GTK_CHECK_VERSION (3, 0, 0) GtkBorder padding; -#else - GtkBorder *inner_border = NULL; -#endif GtkRequisition toplevel_request, widget_request; int base_width, base_height; int char_width, char_height; @@ -3089,33 +2989,18 @@ terminal_window_update_geometry (TerminalWindow *window) * padding we need to change the hints when the theme changes. */ -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (window), NULL, &toplevel_request); gtk_widget_get_preferred_size (widget, NULL, &widget_request); -#else - gtk_widget_size_request (GTK_WIDGET (window), &toplevel_request); - gtk_widget_size_request (widget, &widget_request); -#endif base_width = toplevel_request.width - widget_request.width; base_height = toplevel_request.height - widget_request.height; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_get_padding (gtk_widget_get_style_context (widget), gtk_widget_get_state_flags (widget), &padding); hints.base_width = base_width + padding.left + padding.right; hints.base_height = base_height + padding.top + padding.bottom; -#else - gtk_widget_style_get (widget, "inner-border", &inner_border, NULL); - - hints.base_width = base_width + (inner_border ? (inner_border->left + inner_border->right) : 0); - hints.base_height = base_height + (inner_border ? (inner_border->top + inner_border->bottom) : 0); - - gtk_border_free (inner_border); - inner_border = NULL; -#endif #define MIN_WIDTH_CHARS 4 #define MIN_HEIGHT_CHARS 1 @@ -3944,11 +3829,7 @@ terminal_set_title_callback (GtkAction *action, message_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog)); gtk_container_foreach (GTK_CONTAINER (message_area), (GtkCallback) gtk_widget_hide, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); -#else - hbox = gtk_hbox_new (FALSE, 12); -#endif gtk_box_pack_start (GTK_BOX (message_area), hbox, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic (_("_Title:"));