diff options
author | monsta <[email protected]> | 2016-11-22 15:49:16 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2016-11-22 15:49:16 +0300 |
commit | ea481767c4e3ec19136a5b61ad46f244a9a5ffa7 (patch) | |
tree | bbcceb1d2a0be587e7127109f57e41e9e9b43f98 | |
parent | 8f9a34f003061d7c5e6cfe8a8cb64ec6e98d7c4a (diff) | |
download | mate-utils-ea481767c4e3ec19136a5b61ad46f244a9a5ffa7.tar.bz2 mate-utils-ea481767c4e3ec19136a5b61ad46f244a9a5ffa7.tar.xz |
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require mate-panel >= 1.17
34 files changed, 30 insertions, 1815 deletions
diff --git a/Makefile.am b/Makefile.am index b16720ce..e5578b71 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,9 +24,7 @@ EXTRA_DIST = \ DISTCLEANFILES = \ gtk-doc.make -DISTCHECK_CONFIGURE_FLAGS = \ - --enable-gtk-doc \ - --with-gtk=$(GTK_API_VERSION) +DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc # Build ChangeLog from GIT history ChangeLog: @@ -1,3 +1,5 @@ +1.17.0 + 1.16.0 * Add --version command line option to mate-screenshot @@ -17,8 +17,8 @@ Requirements: mate-common >= 1.10.0 glib >= 2.36.0 gio >= 2.36.0 - gtk+ >= 2.24.0 - libmate-panel-applet >= 1.7.0 + gtk+ >= 3.14.0 + libmate-panel-applet >= 1.17.0 libgtop >= 2.12.0 libcanberra-gtk >= 0.4 diff --git a/baobab/src/baobab-cell-renderer-progress.c b/baobab/src/baobab-cell-renderer-progress.c index d4d26db5..94b44d88 100644 --- a/baobab/src/baobab-cell-renderer-progress.c +++ b/baobab/src/baobab-cell-renderer-progress.c @@ -99,11 +99,7 @@ baobab_cell_renderer_progress_set_property (GObject *object, static void baobab_cell_renderer_progress_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, @@ -146,7 +142,6 @@ baobab_cell_renderer_progress_get_size (GtkCellRenderer *cell, static void set_color_according_to_perc (cairo_t *cr, double value) { -#if GTK_CHECK_VERSION (3, 0, 0) static GdkRGBA red; static GdkRGBA yellow; static GdkRGBA green; @@ -181,42 +176,6 @@ set_color_according_to_perc (cairo_t *cr, double value) { gdk_cairo_set_source_rgba (cr, &red); return; -#else - static GdkColor red; - static GdkColor yellow; - static GdkColor green; - static gboolean colors_initialized = FALSE; - - if (!colors_initialized) - { - /* hardcoded tango colors */ - gdk_color_parse ("#cc0000", &red); - gdk_color_parse ("#edd400", &yellow); - gdk_color_parse ("#73d216", &green); - - colors_initialized = TRUE; - } - - if (value <= 0) - { - cairo_set_source_rgb (cr, 1, 1, 1); - return; - } - else if (value <= 33.33) - { - gdk_cairo_set_source_color (cr, &green); - return; - } - else if (value <= 66.66) - { - gdk_cairo_set_source_color (cr, &yellow); - return; - } - else if (value <= 100.0) - { - gdk_cairo_set_source_color (cr, &red); - return; -#endif } else g_assert_not_reached (); @@ -224,38 +183,21 @@ set_color_according_to_perc (cairo_t *cr, double value) static void baobab_cell_renderer_progress_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 guint flags) { BaobabCellRendererProgress *cellprogress = BAOBAB_CELL_RENDERER_PROGRESS (cell); gint x, y, w, h, perc_w; gboolean is_rtl; -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_t *cr; -#endif gint xpad; gint ypad; GtkStyle *style; is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL; -#if !GTK_CHECK_VERSION (3, 0, 0) - cr = gdk_cairo_create (window); -#endif - gtk_cell_renderer_get_padding (cell, &xpad, &ypad); x = cell_area->x + xpad; @@ -290,10 +232,6 @@ baobab_cell_renderer_progress_render (GtkCellRenderer *cell, cairo_rectangle (cr, is_rtl ? (x + w - perc_w) : x, y, perc_w, h); set_color_according_to_perc (cr, cellprogress->priv->perc); cairo_fill (cr); - -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif } static void diff --git a/baobab/src/baobab-chart.c b/baobab/src/baobab-chart.c index 03c88338..d981c773 100644 --- a/baobab/src/baobab-chart.c +++ b/baobab/src/baobab-chart.c @@ -35,10 +35,8 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> -#if GTK_CHECK_VERSION (3, 0, 0) /* needed for floor and ceil */ #include <math.h> -#endif #include "baobab-chart.h" @@ -149,11 +147,7 @@ static void baobab_chart_rows_reordered (GtkTreeModel *model, gint *new_order, gpointer data); static gboolean baobab_chart_expose (GtkWidget *chart, -#if GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr); -#else - GdkEventExpose *event); -#endif static void baobab_chart_interpolate_colors (BaobabChartColor *color, BaobabChartColor colora, BaobabChartColor colorb, @@ -195,11 +189,7 @@ baobab_chart_class_init (BaobabChartClass *class) /* GtkWidget signals */ widget_class->realize = baobab_chart_realize; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = baobab_chart_expose; -#else - widget_class->expose_event = baobab_chart_expose; -#endif widget_class->size_allocate = baobab_chart_size_allocate; widget_class->scroll_event = baobab_chart_scroll; @@ -314,9 +304,7 @@ baobab_chart_realize (GtkWidget *widget) gint attributes_mask; GtkAllocation allocation; GdkWindow *window; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; -#endif g_return_if_fail (BAOBAB_IS_CHART (widget)); @@ -332,16 +320,9 @@ baobab_chart_realize (GtkWidget *widget) attributes.height = allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); -#if !GTK_CHECK_VERSION (3, 0, 0) - attributes.colormap = gtk_widget_get_colormap (widget); -#endif attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK; -#if GTK_CHECK_VERSION (3, 0, 0) attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; -#else - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; -#endif window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, @@ -349,15 +330,8 @@ baobab_chart_realize (GtkWidget *widget) gtk_widget_set_window (widget, window); gdk_window_set_user_data (window, chart); -#if GTK_CHECK_VERSION (3, 0, 0) context = gtk_widget_get_style_context (widget); gtk_style_context_set_background (context, window); -#else - gtk_widget_style_attach (widget); - gtk_style_set_background (gtk_widget_get_style (widget), - window, - GTK_STATE_NORMAL); -#endif gtk_widget_add_events (widget, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | @@ -780,15 +754,8 @@ baobab_chart_rows_reordered (GtkTreeModel *model, } static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) baobab_chart_expose (GtkWidget *chart, cairo_t *cr) -#else -baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event) -#endif { -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_t *cr; -#endif BaobabChartPrivate *priv; gint w, h; gdouble p, sx, sy; @@ -796,7 +763,6 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event) GtkTreePath *current_path = NULL; GtkAllocation allocation; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRectangle area; gdouble x1, y1, x2, y2; cairo_clip_extents (cr, &x1, &y1, &x2, &y2); @@ -804,7 +770,6 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event) area.y = floor (y1); area.width = ceil (x2) - area.x; area.height = ceil (y2) - area.y; -#endif priv = BAOBAB_CHART (chart)->priv; @@ -816,13 +781,8 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event) cr = gdk_cairo_create (gtk_widget_get_window (chart)); cairo_rectangle (cr, -#if GTK_CHECK_VERSION (3, 0, 0) area.x, area.y, area.width, area.height); -#else - event->area.x, event->area.y, - event->area.width, event->area.height); -#endif /* there is no model we can not paint */ if ((priv->is_frozen) || (priv->model == NULL)) @@ -888,17 +848,9 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event) gtk_tree_path_free (root_path); -#if GTK_CHECK_VERSION (3, 0, 0) baobab_chart_draw (chart, cr, area); -#else - baobab_chart_draw (chart, cr, event->area); -#endif } -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif - return FALSE; } @@ -1229,16 +1181,8 @@ baobab_chart_get_pixbuf (GtkWidget *widget) h = gdk_window_get_height(gtk_widget_get_window(widget)); -#if GTK_CHECK_VERSION(3, 0, 0) pixbuf = gdk_pixbuf_get_from_window ( -#else - pixbuf = gdk_pixbuf_get_from_drawable (NULL, -#endif gtk_widget_get_window (widget), -#if !GTK_CHECK_VERSION(3, 0, 0) - gdk_colormap_get_system (), - 0, 0, -#endif 0, 0, w, h); @@ -1794,19 +1738,11 @@ baobab_chart_save_snapshot (GtkWidget *chart) gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fs_dlg), TRUE); /* extra widget */ -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - vbox = gtk_vbox_new (FALSE, 0); -#endif gtk_container_set_border_width (GTK_CONTAINER (vbox), 0); gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (fs_dlg), vbox); -#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 (vbox), hbox, TRUE, TRUE, 6); label = gtk_label_new_with_mnemonic (_("_Image type:")); diff --git a/baobab/src/baobab-remote-connect-dialog.c b/baobab/src/baobab-remote-connect-dialog.c index e8eed953..c535a851 100644 --- a/baobab/src/baobab-remote-connect-dialog.c +++ b/baobab/src/baobab-remote-connect-dialog.c @@ -43,13 +43,7 @@ */ struct _BaobabRemoteConnectDialogDetails { - -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif - GtkWidget *type_combo; GtkWidget *uri_entry; GtkWidget *server_entry; @@ -395,11 +389,7 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) { struct MethodInfo *meth; int index, i; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *label, *grid; -#else - GtkWidget *label, *table; -#endif GtkTreeIter iter; /* Get our method info */ @@ -409,7 +399,6 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) g_assert (index < G_N_ELEMENTS (methods) && index >= 0); meth = &(methods[index]); -#if GTK_CHECK_VERSION (3, 0, 0) if (gtk_widget_get_parent (dialog->details->uri_entry) != NULL) { gtk_container_remove (GTK_CONTAINER (dialog->details->grid), dialog->details->uri_entry); @@ -444,42 +433,6 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) i = 1; grid = dialog->details->grid; -#else - if (gtk_widget_get_parent (dialog->details->uri_entry) != NULL) { - gtk_container_remove (GTK_CONTAINER (dialog->details->table), - dialog->details->uri_entry); - } - if (gtk_widget_get_parent (dialog->details->server_entry) != NULL) { - gtk_container_remove (GTK_CONTAINER (dialog->details->table), - dialog->details->server_entry); - } - if (gtk_widget_get_parent (dialog->details->share_entry) != NULL) { - gtk_container_remove (GTK_CONTAINER (dialog->details->table), - dialog->details->share_entry); - } - if (gtk_widget_get_parent (dialog->details->port_entry) != NULL) { - gtk_container_remove (GTK_CONTAINER (dialog->details->table), - dialog->details->port_entry); - } - if (gtk_widget_get_parent (dialog->details->folder_entry) != NULL) { - gtk_container_remove (GTK_CONTAINER (dialog->details->table), - dialog->details->folder_entry); - } - if (gtk_widget_get_parent (dialog->details->user_entry) != NULL) { - gtk_container_remove (GTK_CONTAINER (dialog->details->table), - dialog->details->user_entry); - } - if (gtk_widget_get_parent (dialog->details->domain_entry) != NULL) { - gtk_container_remove (GTK_CONTAINER (dialog->details->table), - dialog->details->domain_entry); - } - /* Destroy all labels */ - gtk_container_foreach (GTK_CONTAINER (dialog->details->table), - (GtkCallback) gtk_widget_destroy, NULL); - - i = 1; - table = dialog->details->table; -#endif if (meth->scheme == NULL) { label = gtk_label_new_with_mnemonic (_("_Location (URI):")); @@ -490,28 +443,12 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif gtk_widget_show (label); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1); gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->uri_entry); gtk_widget_set_hexpand (dialog->details->uri_entry, TRUE); gtk_widget_show (dialog->details->uri_entry); gtk_grid_attach (GTK_GRID (grid), dialog->details->uri_entry, 1, i, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - i, i+1, - GTK_FILL, GTK_FILL, - 0, 0); - - gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->uri_entry); - gtk_widget_show (dialog->details->uri_entry); - gtk_table_attach (GTK_TABLE (table), dialog->details->uri_entry, - 1, 2, - i, i+1, - GTK_FILL | GTK_EXPAND, GTK_FILL, - 0, 0); -#endif i++; @@ -526,28 +463,12 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif gtk_widget_show (label); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1); gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->server_entry); gtk_widget_set_hexpand (dialog->details->server_entry, TRUE); gtk_widget_show (dialog->details->server_entry); gtk_grid_attach (GTK_GRID (grid), dialog->details->server_entry, 1, i, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - i, i+1, - GTK_FILL, GTK_FILL, - 0, 0); - - gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->server_entry); - gtk_widget_show (dialog->details->server_entry); - gtk_table_attach (GTK_TABLE (table), dialog->details->server_entry, - 1, 2, - i, i+1, - GTK_FILL | GTK_EXPAND, GTK_FILL, - 0, 0); -#endif i++; @@ -559,15 +480,7 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif gtk_widget_show (label); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), label, 0, i, 2, 1); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 2, - i, i+1, - GTK_FILL, GTK_FILL, - 0, 0); -#endif i++; @@ -580,28 +493,12 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif gtk_widget_show (label); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1); gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->share_entry); gtk_widget_set_hexpand (dialog->details->share_entry, TRUE); gtk_widget_show (dialog->details->share_entry); gtk_grid_attach (GTK_GRID (grid), dialog->details->share_entry, 1, i, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - i, i+1, - GTK_FILL, GTK_FILL, - 0, 0); - - gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->share_entry); - gtk_widget_show (dialog->details->share_entry); - gtk_table_attach (GTK_TABLE (table), dialog->details->share_entry, - 1, 2, - i, i+1, - GTK_FILL | GTK_EXPAND, GTK_FILL, - 0, 0); -#endif i++; } @@ -615,28 +512,12 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif gtk_widget_show (label); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1); gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->port_entry); gtk_widget_set_hexpand (dialog->details->port_entry, TRUE); gtk_widget_show (dialog->details->port_entry); gtk_grid_attach (GTK_GRID (grid), dialog->details->port_entry, 1, i, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - i, i+1, - GTK_FILL, GTK_FILL, - 0, 0); - - gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->port_entry); - gtk_widget_show (dialog->details->port_entry); - gtk_table_attach (GTK_TABLE (table), dialog->details->port_entry, - 1, 2, - i, i+1, - GTK_FILL | GTK_EXPAND, GTK_FILL, - 0, 0); -#endif i++; } @@ -649,28 +530,12 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif gtk_widget_show (label); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1); gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->folder_entry); gtk_widget_set_hexpand (dialog->details->folder_entry, TRUE); gtk_widget_show (dialog->details->folder_entry); gtk_grid_attach (GTK_GRID (grid), dialog->details->folder_entry, 1, i, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - i, i+1, - GTK_FILL, GTK_FILL, - 0, 0); - - gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->folder_entry); - gtk_widget_show (dialog->details->folder_entry); - gtk_table_attach (GTK_TABLE (table), dialog->details->folder_entry, - 1, 2, - i, i+1, - GTK_FILL | GTK_EXPAND, GTK_FILL, - 0, 0); -#endif i++; @@ -683,28 +548,12 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif gtk_widget_show (label); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1); gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->user_entry); gtk_widget_set_hexpand (dialog->details->user_entry, TRUE); gtk_widget_show (dialog->details->user_entry); gtk_grid_attach (GTK_GRID (grid), dialog->details->user_entry, 1, i, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - i, i+1, - GTK_FILL, GTK_FILL, - 0, 0); - - gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->user_entry); - gtk_widget_show (dialog->details->user_entry); - gtk_table_attach (GTK_TABLE (table), dialog->details->user_entry, - 1, 2, - i, i+1, - GTK_FILL | GTK_EXPAND, GTK_FILL, - 0, 0); -#endif i++; } @@ -718,28 +567,12 @@ setup_for_type (BaobabRemoteConnectDialog *dialog) gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); #endif gtk_widget_show (label); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1); gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->domain_entry); gtk_widget_set_hexpand (dialog->details->user_entry, TRUE); gtk_widget_show (dialog->details->domain_entry); gtk_grid_attach (GTK_GRID (grid), dialog->details->domain_entry, 1, i, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, - i, i+1, - GTK_FILL, GTK_FILL, - 0, 0); - - gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->details->domain_entry); - gtk_widget_show (dialog->details->domain_entry); - gtk_table_attach (GTK_TABLE (table), dialog->details->domain_entry, - 1, 2, - i, i+1, - GTK_FILL | GTK_EXPAND, GTK_FILL, - 0, 0); -#endif i++; } @@ -781,11 +614,7 @@ static void baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog) { GtkWidget *label; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *combo; GtkWidget *hbox; GtkWidget *vbox; @@ -800,21 +629,13 @@ baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog) gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - vbox = gtk_vbox_new (FALSE, 6); -#endif gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox, FALSE, TRUE, 0); gtk_widget_show (vbox); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - hbox = gtk_hbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); gtk_widget_show (hbox); @@ -890,11 +711,7 @@ baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog) G_CALLBACK (combo_changed_callback), dialog); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - hbox = gtk_hbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); gtk_widget_show (hbox); @@ -905,21 +722,12 @@ baobab_remote_connect_dialog_init (BaobabRemoteConnectDialog *dialog) label, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) dialog->details->grid = grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_grid_set_column_spacing (GTK_GRID (grid), 12); gtk_widget_show (grid); gtk_box_pack_start (GTK_BOX (hbox), grid, TRUE, TRUE, 0); -#else - dialog->details->table = table = gtk_table_new (5, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 12); - gtk_widget_show (table); - gtk_box_pack_start (GTK_BOX (hbox), - table, TRUE, TRUE, 0); -#endif dialog->details->uri_entry = gtk_entry_new(); dialog->details->server_entry = gtk_entry_new (); diff --git a/baobab/src/baobab.c b/baobab/src/baobab.c index 9497e850..95b9f3f6 100644 --- a/baobab/src/baobab.c +++ b/baobab/src/baobab.c @@ -695,10 +695,6 @@ baobab_create_statusbar (void) return; } -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (baobab.statusbar), TRUE); -#endif - g_settings_bind (baobab.ui_settings, BAOBAB_SETTINGS_STATUSBAR_VISIBLE, baobab.statusbar, "visible", diff --git a/configure.ac b/configure.ac index 33570bd7..ef0e9f41 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ m4_define([mate_utils_major], [1]) -m4_define([mate_utils_minor], [16]) +m4_define([mate_utils_minor], [17]) m4_define([mate_utils_micro], [0]) m4_define([mate_utils_version], [mate_utils_major.mate_utils_minor.mate_utils_micro]) @@ -62,34 +62,11 @@ dnl pkg-config check GLIB_REQUIRED=2.36.0 GIO_REQUIRED=2.36.0 GIO_UNIX_REQUIRED=2.18.0 -LIBMATE_PANEL_APPLET_REQUIRED=1.7.0 +GTK_REQUIRED=3.14.0 +LIBMATE_PANEL_APPLET_REQUIRED=1.17.0 LIBGTOP_REQUIRED=2.12.0 +LIBCANBERRA_GTK_REQUIRED=0.4 -dnl GTK library version - -AC_MSG_CHECKING([which gtk+ version to compile against]) -AC_ARG_WITH([gtk], - [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])], - [case "$with_gtk" in - 2.0|3.0) ;; - *) AC_MSG_ERROR([invalid gtk version specified]) ;; - esac], - [with_gtk=2.0]) -AC_MSG_RESULT([$with_gtk]) - -case "$with_gtk" in - 2.0) GTK_API_VERSION=2.0 - GTK_REQUIRED=2.24.0 - LIBCANBERRA_GTK_VERSION=libcanberra-gtk - LIBCANBERRA_GTK_REQUIRED=0.4 - ;; - 3.0) GTK_API_VERSION=3.0 - GTK_REQUIRED=3.0.0 - LIBCANBERRA_GTK_VERSION=libcanberra-gtk3 - LIBCANBERRA_GTK_REQUIRED=0.4 - ;; -esac -AC_SUBST(GTK_API_VERSION) AC_SUBST(GTK_REQUIRED) # common checks @@ -109,18 +86,18 @@ PKG_CHECK_MODULES(GIO_UNIX, gio-unix-2.0 >= $GIO_UNIX_REQUIRED) AC_SUBST(GIO_UNIX_CFLAGS) AC_SUBST(GIO_UNIX_LIBS) -PKG_CHECK_MODULES(GTK, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED) +PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED) AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) # libeggsmclient -PKG_CHECK_MODULES(LIBEGGSMCLIENT, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED) +PKG_CHECK_MODULES(LIBEGGSMCLIENT, gtk+-3.0 >= $GTK_REQUIRED) AC_SUBST(LIBEGGSMCLIENT_CFLAGS) AC_SUBST(LIBEGGSMCLIENT_LIBS) # libgdict requires just gtk+ -PKG_CHECK_MODULES(LIBGDICT, glib-2.0 >= $GLIB_REQUIRED dnl - gtk+-$GTK_API_VERSION >= $GTK_REQUIRED) +PKG_CHECK_MODULES(LIBGDICT, glib-2.0 >= $GLIB_REQUIRED + gtk+-3.0 >= $GTK_REQUIRED) AC_SUBST(LIBGDICT_CFLAGS) AC_SUBST(LIBGDICT_LIBS) @@ -179,7 +156,7 @@ PKG_CHECK_MODULES(LIBGTOP, libgtop-2.0 >= $LIBGTOP_REQUIRED) AC_SUBST(LIBGTOP_CFLAGS) AC_SUBST(LIBGTOP_LIBS) -PKG_CHECK_MODULES(LIBCANBERRA_GTK, $LIBCANBERRA_GTK_VERSION >= $LIBCANBERRA_GTK_REQUIRED) +PKG_CHECK_MODULES(LIBCANBERRA_GTK, libcanberra-gtk3 >= $LIBCANBERRA_GTK_REQUIRED) AC_SUBST(LIBCANBERRA_GTK_CFLAGS) AC_SUBST(LIBCANBERRA_GTK_LIBS) @@ -425,7 +402,6 @@ mate-utils $VERSION configuration summary: sbin dir : $sbindir data dir : $datadir - GTK+ API version : $GTK_API_VERSION Debug messages (libmatedict) : $enable_debug API Reference (libmatedict) : $enable_gtk_doc Logview built with ZLib support : $msg_zlib diff --git a/gsearchtool/libeggsmclient/eggsmclient-private.h b/gsearchtool/libeggsmclient/eggsmclient-private.h index 1313855b..5a2121a8 100644 --- a/gsearchtool/libeggsmclient/eggsmclient-private.h +++ b/gsearchtool/libeggsmclient/eggsmclient-private.h @@ -21,9 +21,6 @@ #define __EGG_SM_CLIENT_PRIVATE_H__ #include <gtk/gtk.h> -#if !GTK_CHECK_VERSION (3, 0, 0) -#include <gdkconfig.h> -#endif #include "eggsmclient.h" G_BEGIN_DECLS @@ -46,5 +43,4 @@ EggSMClient *egg_sm_client_dbus_new (void); G_END_DECLS - #endif /* __EGG_SM_CLIENT_PRIVATE_H__ */ diff --git a/gsearchtool/libeggsmclient/eggsmclient-xsmp.c b/gsearchtool/libeggsmclient/eggsmclient-xsmp.c index 4dbb3ad2..97813788 100644 --- a/gsearchtool/libeggsmclient/eggsmclient-xsmp.c +++ b/gsearchtool/libeggsmclient/eggsmclient-xsmp.c @@ -367,13 +367,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); } @@ -541,10 +535,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) @@ -568,9 +558,6 @@ idle_do_pending_events (gpointer data) } out: -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif return FALSE; } @@ -1291,13 +1278,7 @@ static gboolean 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/gsearchtool/libmateui-deprecated/gsearchtool-entry.c b/gsearchtool/libmateui-deprecated/gsearchtool-entry.c index 4916865a..daa3c9aa 100644 --- a/gsearchtool/libmateui-deprecated/gsearchtool-entry.c +++ b/gsearchtool/libmateui-deprecated/gsearchtool-entry.c @@ -111,20 +111,12 @@ gsearch_history_entry_get_property (GObject *object, } static void -#if GTK_CHECK_VERSION (3, 0, 0) gsearch_history_entry_destroy (GtkWidget *object) -#else -gsearch_history_entry_destroy (GtkObject *object) -#endif { gsearch_history_entry_set_enable_completion (GSEARCH_HISTORY_ENTRY (object), FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (gsearch_history_entry_parent_class)->destroy (object); -#else - GTK_OBJECT_CLASS (gsearch_history_entry_parent_class)->destroy (object); -#endif } static void @@ -149,20 +141,12 @@ static void gsearch_history_entry_class_init (GsearchHistoryEntryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass); -#else - GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); -#endif object_class->set_property = gsearch_history_entry_set_property; object_class->get_property = gsearch_history_entry_get_property; object_class->finalize = gsearch_history_entry_finalize; -#if GTK_CHECK_VERSION (3, 0, 0) gtkwidget_class->destroy = gsearch_history_entry_destroy; -#else - gtkobject_class->destroy = gsearch_history_entry_destroy; -#endif g_object_class_install_property (object_class, PROP_HISTORY_ID, diff --git a/gsearchtool/src/gsearchtool-support.c b/gsearchtool/src/gsearchtool-support.c index d12cdbfb..b4bdc0b1 100644 --- a/gsearchtool/src/gsearchtool-support.c +++ b/gsearchtool/src/gsearchtool-support.c @@ -897,11 +897,7 @@ get_themed_icon_pixbuf (GThemedIcon * icon, g_clear_error (&error); } -#if GTK_CHECK_VERSION (3, 8, 0) g_object_unref (icon_info); -#else - gtk_icon_info_free (icon_info); -#endif g_strfreev (icon_names); return pixbuf; @@ -952,10 +948,8 @@ open_file_with_filemanager (GtkWidget * window, GDesktopAppInfo * d_app_info; GKeyFile * key_file; GdkAppLaunchContext * ctx = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) GdkScreen *screen; GdkDisplay *display; -#endif GList * list = NULL; GAppInfo * g_app_info; GFile * g_file; @@ -995,13 +989,9 @@ open_file_with_filemanager (GtkWidget * window, d_app_info = g_desktop_app_info_new_from_keyfile (key_file); if (d_app_info != NULL) { -#if GTK_CHECK_VERSION (3, 0, 0) screen = gtk_widget_get_screen (GTK_WIDGET (window)); display = gdk_screen_get_display (screen); ctx = gdk_display_get_app_launch_context (display); -#else - ctx = gdk_app_launch_context_new (); -#endif gdk_app_launch_context_set_screen (ctx, gtk_widget_get_screen (window)); result = g_app_info_launch_uris (G_APP_INFO (d_app_info), list, G_APP_LAUNCH_CONTEXT (ctx), NULL); @@ -1029,9 +1019,7 @@ open_file_with_application (GtkWidget * window, GAppInfo * app) { GdkAppLaunchContext * context; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; -#endif GdkScreen * screen; gboolean result; @@ -1040,12 +1028,8 @@ open_file_with_application (GtkWidget * window, } screen = gtk_widget_get_screen (window); -#if GTK_CHECK_VERSION (3, 0, 0) display = gdk_screen_get_display (screen); context = gdk_display_get_app_launch_context (display); -#else - context = gdk_app_launch_context_new (); -#endif gdk_app_launch_context_set_screen (context, screen); if (app == NULL) { @@ -1146,11 +1130,7 @@ gsearchtool_button_new_with_stock_icon (const gchar * string, label = gtk_label_new_with_mnemonic (string); gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button)); image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); -#else - hbox = gtk_hbox_new (FALSE, 2); -#endif align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); diff --git a/gsearchtool/src/gsearchtool.c b/gsearchtool/src/gsearchtool.c index 8b42b662..eeae2ecd 100644 --- a/gsearchtool/src/gsearchtool.c +++ b/gsearchtool/src/gsearchtool.c @@ -1738,11 +1738,7 @@ handle_search_command_stderr_io (GIOChannel * ioc, gtk_window_set_title (GTK_WINDOW (dialog), ""); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif spacer = gtk_label_new (" "); gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0); @@ -1786,11 +1782,7 @@ handle_search_command_stderr_io (GIOChannel * ioc, gtk_window_set_title (GTK_WINDOW (dialog), ""); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif spacer = gtk_label_new (" "); gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0); @@ -1964,11 +1956,7 @@ create_constraint_box (GSearchWindow * gsearch, GtkWidget * entry_hbox; GtkWidget * button; -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); -#else - hbox = gtk_hbox_new (FALSE, 12); -#endif switch (GSearchOptionTemplates[opt->constraint_id].type) { case SEARCH_CONSTRAINT_TYPE_BOOLEAN: @@ -2044,11 +2032,7 @@ create_constraint_box (GSearchWindow * gsearch, (gpointer) gsearch); /* add text field */ -#if GTK_CHECK_VERSION (3, 0, 0) entry_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - entry_hbox = gtk_hbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (hbox), entry_hbox, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (entry_hbox), entry, TRUE, TRUE, 0); @@ -2175,13 +2159,8 @@ create_additional_constraint_section (GSearchWindow * gsearch) GtkWidget * hbox; gchar * desc; -#if GTK_CHECK_VERSION (3, 0, 0) gsearch->available_options_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); -#else - gsearch->available_options_vbox = gtk_vbox_new (FALSE, 6); - hbox = gtk_hbox_new (FALSE, 12); -#endif gtk_box_pack_end (GTK_BOX (gsearch->available_options_vbox), hbox, FALSE, FALSE, 0); @@ -2312,13 +2291,8 @@ create_search_results_section (GSearchWindow * gsearch) GtkTreeViewColumn * column; GtkCellRenderer * renderer; -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - vbox = gtk_vbox_new (FALSE, 6); - hbox = gtk_hbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); @@ -2362,9 +2336,6 @@ create_search_results_section (GSearchWindow * gsearch) gtk_tree_view_set_headers_visible (gsearch->search_results_tree_view, FALSE); gtk_tree_view_set_search_equal_func (gsearch->search_results_tree_view, gsearch_equal_func, NULL, NULL); -#if !GTK_CHECK_VERSION (3, 14, 0) - gtk_tree_view_set_rules_hint (gsearch->search_results_tree_view, TRUE); -#endif g_object_unref (G_OBJECT (gsearch->search_results_list_store)); if (gsearch->is_window_accessible) { @@ -2812,51 +2783,29 @@ gsearch_app_create (GSearchWindow * gsearch) gtk_window_maximize (GTK_WINDOW (gsearch->window)); } -#if GTK_CHECK_VERSION (3, 0, 0) container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - container = gtk_vbox_new (FALSE, 6); -#endif gtk_container_add (GTK_CONTAINER (gsearch->window), container); gtk_container_set_border_width (GTK_CONTAINER (container), 12); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - hbox = gtk_hbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (container), hbox, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gsearch->name_and_folder_table = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (gsearch->name_and_folder_table), 6); gtk_grid_set_column_spacing (GTK_GRID (gsearch->name_and_folder_table), 12); -#else - gsearch->name_and_folder_table = gtk_table_new (2, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (gsearch->name_and_folder_table), 6); - gtk_table_set_col_spacings (GTK_TABLE (gsearch->name_and_folder_table), 12); -#endif gtk_container_add (GTK_CONTAINER (hbox), gsearch->name_and_folder_table); label = gtk_label_new_with_mnemonic (_("_Name contains:")); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (label), "xalign", 0.0, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (gsearch->name_and_folder_table), label, 0, 0, 1, 1); -#else - gtk_table_attach (GTK_TABLE (gsearch->name_and_folder_table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 1); -#endif gsearch->name_contains_entry = gsearch_history_entry_new ("gsearchtool-file-entry", FALSE); gtk_label_set_mnemonic_widget (GTK_LABEL (label), gsearch->name_contains_entry); gsearch_history_entry_set_history_length (GSEARCH_HISTORY_ENTRY (gsearch->name_contains_entry), 10); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_hexpand (gsearch->name_contains_entry, TRUE); gtk_grid_attach (GTK_GRID (gsearch->name_and_folder_table), gsearch->name_contains_entry, 1, 0, 1, 1); -#else - gtk_table_attach (GTK_TABLE (gsearch->name_and_folder_table), gsearch->name_contains_entry, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0); -#endif entry = gsearch_history_entry_get_entry (GSEARCH_HISTORY_ENTRY (gsearch->name_contains_entry)); if (GTK_IS_ACCESSIBLE (gtk_widget_get_accessible (gsearch->name_contains_entry))) { @@ -2872,20 +2821,12 @@ gsearch_app_create (GSearchWindow * gsearch) gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (label), "xalign", 0.0, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (gsearch->name_and_folder_table), label, 0, 1, 1, 1); -#else - gtk_table_attach (GTK_TABLE (gsearch->name_and_folder_table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); -#endif gsearch->look_in_folder_button = gtk_file_chooser_button_new (_("Browse"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (gsearch->look_in_folder_button)); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_hexpand (gsearch->look_in_folder_button, TRUE); gtk_grid_attach (GTK_GRID (gsearch->name_and_folder_table), gsearch->look_in_folder_button, 1, 1, 1, 1); -#else - gtk_table_attach (GTK_TABLE (gsearch->name_and_folder_table), gsearch->look_in_folder_button, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0); -#endif g_signal_connect (G_OBJECT (gsearch->look_in_folder_button), "current-folder-changed", G_CALLBACK (look_in_folder_changed_cb), @@ -2924,22 +2865,14 @@ gsearch_app_create (GSearchWindow * gsearch) add_atk_relation (GTK_WIDGET (gsearch->show_more_options_expander), GTK_WIDGET (gsearch->available_options_vbox), ATK_RELATION_CONTROLLER_FOR); } -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); -#else - vbox = gtk_vbox_new (FALSE, 12); -#endif gtk_box_pack_start (GTK_BOX (container), vbox, TRUE, TRUE, 0); gsearch->search_results_vbox = create_search_results_section (gsearch); gtk_widget_set_sensitive (GTK_WIDGET (gsearch->search_results_vbox), FALSE); gtk_box_pack_start (GTK_BOX (vbox), gsearch->search_results_vbox, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); -#else - hbox = gtk_hbutton_box_new (); -#endif gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); diff --git a/logview/src/logview-filter-manager.c b/logview/src/logview-filter-manager.c index 080e012a..bcfef5a9 100644 --- a/logview/src/logview-filter-manager.c +++ b/logview/src/logview-filter-manager.c @@ -213,7 +213,6 @@ on_dialog_add_edit_reponse (GtkWidget *dialog, int response_id, if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_color))) { if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_foreground))) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA foreground_color; gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (color_foreground), &foreground_color); @@ -229,23 +228,6 @@ on_dialog_add_edit_reponse (GtkWidget *dialog, int response_id, g_object_set (tag, "paragraph-background-rgba", &background_color, "paragraph-background-set", TRUE, NULL); -#else - GdkColor foreground_color; - gtk_color_button_get_color (GTK_COLOR_BUTTON (color_foreground), - &foreground_color); - g_object_set (G_OBJECT (tag), - "foreground-gdk", &foreground_color, - "foreground-set", TRUE, NULL); - } - - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_background))) { - GdkColor background_color; - gtk_color_button_get_color (GTK_COLOR_BUTTON (color_background), - &background_color); - g_object_set (tag, - "paragraph-background-gdk", &background_color, - "paragraph-background-set", TRUE, NULL); -#endif } if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_foreground)) @@ -368,7 +350,6 @@ run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter) gtk_entry_set_text (GTK_ENTRY(entry_regex), regex); if (foreground_set) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *foreground; g_object_get (tag, "foreground-rgba", &foreground, NULL); @@ -390,29 +371,6 @@ run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter) TRUE); gdk_rgba_free (background); -#else - GdkColor *foreground; - - g_object_get (tag, "foreground-gdk", &foreground, NULL); - gtk_color_button_set_color (GTK_COLOR_BUTTON (color_foreground), - foreground); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_foreground), - TRUE); - - gdk_color_free (foreground); - } - - if (background_set) { - GdkColor *background; - - g_object_get (tag, "paragraph-background-gdk", &background, NULL); - gtk_color_button_set_color (GTK_COLOR_BUTTON (color_background), - background); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_background), - TRUE); - - gdk_color_free (background); -#endif } if (background_set || foreground_set) { @@ -496,11 +454,7 @@ on_tree_selection_changed (GtkTreeSelection *selection, LogviewFilterManager *ma static void logview_filter_manager_init (LogviewFilterManager *manager) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *scrolled_window; GtkTreeViewColumn *column; GtkCellRenderer *text_renderer; @@ -524,13 +478,9 @@ logview_filter_manager_init (LogviewFilterManager *manager) G_TYPE_OBJECT)); logview_filter_manager_update_model (manager); -#if GTK_CHECK_VERSION (3, 0, 0) grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_grid_set_column_spacing (GTK_GRID (grid), 6); -#else - table = gtk_table_new (3, 2, FALSE); -#endif scrolled_window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -573,7 +523,6 @@ logview_filter_manager_init (LogviewFilterManager *manager) "changed", G_CALLBACK (on_tree_selection_changed), manager); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_hexpand (scrolled_window, TRUE); gtk_widget_set_vexpand (scrolled_window, TRUE); gtk_grid_attach (GTK_GRID (grid), scrolled_window, 0, 0, 1, 3); @@ -585,22 +534,6 @@ logview_filter_manager_init (LogviewFilterManager *manager) gtk_grid_attach (GTK_GRID (grid), priv->remove_button, 1, 2, 1, 1); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (manager))), grid, TRUE, TRUE, 5); -#else - gtk_table_attach_defaults (GTK_TABLE (table), - scrolled_window, - 0, 1, 0, 3); - gtk_table_attach (GTK_TABLE (table), - priv->add_button, - 1, 2, 0, 1, GTK_FILL, 0, 5, 5); - gtk_table_attach (GTK_TABLE (table), - priv->edit_button, - 1, 2, 1, 2, GTK_FILL, 0, 5, 5); - gtk_table_attach (GTK_TABLE (table), - priv->remove_button, - 1, 2, 2, 3, GTK_FILL, 0, 5, 5); - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (manager))), - table, TRUE, TRUE, 5); -#endif gtk_widget_show_all (GTK_WIDGET (manager)); } diff --git a/logview/src/logview-findbar.c b/logview/src/logview-findbar.c index ece45651..bf71a260 100644 --- a/logview/src/logview-findbar.c +++ b/logview/src/logview-findbar.c @@ -139,11 +139,7 @@ unbold_timeout_cb (gpointer user_data) PangoFontDescription *desc; desc = pango_font_description_new (); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_font (findbar->priv->message, desc); -#else - gtk_widget_modify_font (findbar->priv->message, desc); -#endif pango_font_description_free (desc); findbar->priv->status_bold_id = 0; @@ -171,11 +167,7 @@ logview_findbar_init (LogviewFindbar *findbar) w = gtk_alignment_new (0.0, 0.5, 1.0, 1.0); gtk_alignment_set_padding (GTK_ALIGNMENT (w), 0, 0, 2, 2); -#if GTK_CHECK_VERSION (3, 0, 0) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); -#else - box = gtk_hbox_new (FALSE, 12); -#endif gtk_container_add (GTK_CONTAINER (w), box); label = gtk_label_new_with_mnemonic (_("_Find:")); @@ -192,11 +184,7 @@ logview_findbar_init (LogviewFindbar *findbar) gtk_widget_show_all (GTK_WIDGET (item)); /* "Previous" and "Next" buttons */ -#if GTK_CHECK_VERSION (3, 0, 0) w = gtk_image_new_from_icon_name ("pan-start-symbolic", GTK_ICON_SIZE_BUTTON); -#else - w = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE); -#endif priv->back_button = gtk_tool_button_new (w, _("Find Previous")); gtk_tool_item_set_is_important (priv->back_button, TRUE); gtk_tool_item_set_tooltip_text (priv->back_button, @@ -204,11 +192,7 @@ logview_findbar_init (LogviewFindbar *findbar) gtk_toolbar_insert (gtoolbar, priv->back_button, -1); gtk_widget_show_all (GTK_WIDGET (priv->back_button)); -#if GTK_CHECK_VERSION (3, 0, 0) w = gtk_image_new_from_icon_name ("pan-end-symbolic", GTK_ICON_SIZE_BUTTON); -#else - w = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE); -#endif priv->forward_button = gtk_tool_button_new (w, _("Find Next")); gtk_tool_item_set_is_important (priv->forward_button, TRUE); gtk_tool_item_set_tooltip_text (priv->forward_button, @@ -360,11 +344,7 @@ logview_findbar_set_message (LogviewFindbar *findbar, if (text) { desc = pango_font_description_new (); pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_font (findbar->priv->message, desc); -#else - gtk_widget_modify_font (findbar->priv->message, desc); -#endif pango_font_description_free (desc); findbar->priv->status_bold_id = g_timeout_add (600, unbold_timeout_cb, findbar); diff --git a/logview/src/logview-prefs.c b/logview/src/logview-prefs.c index 2cf8a366..e0fe79c2 100644 --- a/logview/src/logview-prefs.c +++ b/logview/src/logview-prefs.c @@ -154,11 +154,7 @@ load_filters (LogviewPrefs *prefs) const gchar *str; LogviewFilter *filter; GtkTextTag *tag; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; -#else - GdkColor color; -#endif gint idx; filters = g_settings_get_strv (prefs->priv->logview_prefs, @@ -178,7 +174,6 @@ load_filters (LogviewPrefs *prefs) g_str_equal (tokens[FILTER_INVISIBLE], "1"), NULL); if (strlen (tokens[FILTER_FOREGROUND])) { -#if GTK_CHECK_VERSION (3, 0, 0) gdk_rgba_parse (&color, tokens[FILTER_FOREGROUND]); g_object_set (tag, "foreground-rgba", &color, "foreground-set", TRUE, NULL); @@ -187,16 +182,6 @@ load_filters (LogviewPrefs *prefs) if (strlen (tokens[FILTER_BACKGROUND])) { gdk_rgba_parse (&color, tokens[FILTER_BACKGROUND]); g_object_set (tag, "paragraph-background-rgba", &color, -#else - gdk_color_parse (tokens[FILTER_FOREGROUND], &color); - g_object_set (tag, "foreground-gdk", &color, - "foreground-set", TRUE, NULL); - } - - if (strlen (tokens[FILTER_BACKGROUND])) { - gdk_color_parse (tokens[FILTER_BACKGROUND], &color); - g_object_set (tag, "paragraph-background-gdk", &color, -#endif "paragraph-background-set", TRUE, NULL); } @@ -219,15 +204,9 @@ save_filter_foreach_func (gpointer key, gpointer value, gpointer user_data) GPtrArray *filters; const gchar *name; LogviewFilter *filter; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA *foreground; gboolean foreground_set; GdkRGBA *background; -#else - GdkColor *foreground; - gboolean foreground_set; - GdkColor *background; -#endif gboolean background_set; gchar *regex, *color; gboolean invisible; @@ -247,7 +226,6 @@ save_filter_foreach_func (gpointer key, gpointer value, gpointer user_data) "texttag", &tag, NULL); g_object_get (tag, -#if GTK_CHECK_VERSION (3, 0, 0) "foreground-set", &foreground_set, "foreground-rgba", &foreground, "paragraph-background-set", &background_set, @@ -281,41 +259,6 @@ save_filter_foreach_func (gpointer key, gpointer value, gpointer user_data) if (background) { gdk_rgba_free (background); } -#else - "foreground-gdk", &foreground, - "paragraph-background-gdk", &background, - "foreground-set", &foreground_set, - "paragraph-background-set", &background_set, - "invisible", &invisible, NULL); - - if (invisible) { - g_string_append (prefs_string, "1" DELIMITER); - } else { - g_string_append (prefs_string, "0" DELIMITER); - } - - if (foreground_set) { - color = gdk_color_to_string (foreground); - g_string_append (prefs_string, color); - g_free (color); - } - - if (foreground) { - gdk_color_free (foreground); - } - - g_string_append (prefs_string, DELIMITER); - - if (background_set) { - color = gdk_color_to_string (background); - g_string_append (prefs_string, color); - g_free (color); - } - - if (background) { - gdk_color_free (background); - } -#endif g_string_append (prefs_string, DELIMITER); g_string_append (prefs_string, regex); diff --git a/logview/src/logview-window.c b/logview/src/logview-window.c index ad48aefc..d53c9577 100644 --- a/logview/src/logview-window.c +++ b/logview/src/logview-window.c @@ -145,7 +145,6 @@ populate_tag_table (GtkTextTagTable *tag_table) gtk_text_tag_table_add (tag_table, tag); } -#if GTK_CHECK_VERSION (3, 0, 0) static void populate_style_tag_table (LogviewWindow *logview) { @@ -172,28 +171,6 @@ populate_style_tag_table (LogviewWindow *logview) gtk_text_tag_table_add (tag_table, tag); } -#else -static void -populate_style_tag_table (GtkStyle *style, - GtkTextTagTable *tag_table) -{ - GtkTextTag *tag; - GdkColor color; - - tag = gtk_text_tag_table_lookup (tag_table, "gray"); - - if (tag) { - /* FIXME: do we need a way to update the buffer/view? */ - gtk_text_tag_table_remove (tag_table, tag); - } - - tag = gtk_text_tag_new ("gray"); - color = style->text[GTK_STATE_INSENSITIVE]; - g_object_set (tag, "foreground-gdk", &color, "foreground-set", TRUE, NULL); - - gtk_text_tag_table_add (tag_table, tag); -} -#endif static void _gtk_text_buffer_apply_tag_to_rectangle (GtkTextBuffer *buffer, int line_start, int line_end, @@ -267,11 +244,7 @@ logview_set_font (LogviewWindow *logview, font_desc = pango_font_description_from_string (fontname); if (font_desc) { -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_font (logview->priv->text_view, font_desc); -#else - gtk_widget_modify_font (logview->priv->text_view, font_desc); -#endif pango_font_description_free (font_desc); } } @@ -286,11 +259,7 @@ logview_set_fontsize (LogviewWindow *logview, gboolean store) context = gtk_widget_get_pango_context (priv->text_view); fontdesc = pango_context_get_font_description (context); pango_font_description_set_size (fontdesc, (priv->fontsize) * PANGO_SCALE); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_override_font (priv->text_view, fontdesc); -#else - gtk_widget_modify_font (priv->text_view, fontdesc); -#endif if (store) { logview_prefs_store_fontsize (logview->priv->prefs, priv->fontsize); @@ -1159,19 +1128,6 @@ tearoff_changed_cb (LogviewPrefs *prefs, gtk_ui_manager_set_add_tearoffs (window->priv->ui_manager, have_tearoffs); } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -style_set_cb (GtkWidget *widget, - GtkStyle *prev, - gpointer user_data) -{ - LogviewWindow *logview = user_data; - GtkStyle *style = gtk_widget_get_style (widget); - - populate_style_tag_table (style, logview->priv->tag_table); -} -#endif - static const struct { guint keyval; GdkModifierType modifier; @@ -1220,29 +1176,17 @@ message_area_create_error_box (LogviewWindow *window, GtkWidget *primary_label; GtkWidget *secondary_label; -#if GTK_CHECK_VERSION (3, 0, 0) hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); -#else - hbox_content = gtk_hbox_new (FALSE, 8); -#endif gtk_widget_show (hbox_content); image = gtk_image_new_from_icon_name ("dialog-error", GTK_ICON_SIZE_DIALOG); gtk_widget_show (image); gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (image, GTK_ALIGN_CENTER); gtk_widget_set_valign (image, GTK_ALIGN_START); -#else - gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - vbox = gtk_vbox_new (FALSE, 6); -#endif gtk_widget_show (vbox); gtk_box_pack_start (GTK_BOX (hbox_content), vbox, TRUE, TRUE, 0); @@ -1351,11 +1295,7 @@ logview_window_init (LogviewWindow *logview) logview_prefs_get_stored_window_size (priv->prefs, &width, &height); gtk_window_set_default_size (GTK_WINDOW (logview), width, height); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - vbox = gtk_vbox_new (FALSE, 0); -#endif gtk_container_add (GTK_CONTAINER (logview), vbox); /* create menus */ @@ -1390,21 +1330,13 @@ logview_window_init (LogviewWindow *logview) gtk_widget_show (w); /* panes */ -#if GTK_CHECK_VERSION (3, 0, 0) hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); -#else - hpaned = gtk_hpaned_new (); -#endif gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0); priv->hpaned = hpaned; gtk_widget_show (hpaned); /* first pane : sidebar (list of logs) */ -#if GTK_CHECK_VERSION (3, 0, 0) priv->sidebar = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - priv->sidebar = gtk_vbox_new (FALSE, 0); -#endif gtk_widget_show (priv->sidebar); /* first pane: log list */ @@ -1427,11 +1359,7 @@ logview_window_init (LogviewWindow *logview) G_CALLBACK (loglist_day_cleared_cb), logview); /* second pane: log */ -#if GTK_CHECK_VERSION (3, 0, 0) main_view = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - main_view = gtk_vbox_new (FALSE, 0); -#endif gtk_paned_pack2 (GTK_PANED (hpaned), main_view, TRUE, TRUE); /* second pane: error message area */ @@ -1454,9 +1382,7 @@ logview_window_init (LogviewWindow *logview) priv->text_view = gtk_text_view_new (); g_object_set (priv->text_view, "editable", FALSE, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) populate_style_tag_table (logview); -#endif gtk_container_add (GTK_CONTAINER (w), priv->text_view); gtk_widget_show (priv->text_view); @@ -1482,11 +1408,7 @@ logview_window_init (LogviewWindow *logview) } /* version selector */ -#if GTK_CHECK_VERSION (3, 0, 0) priv->version_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - priv->version_bar = gtk_hbox_new (FALSE, 0); -#endif gtk_container_set_border_width (GTK_CONTAINER (priv->version_bar), 3); priv->version_selector = gtk_combo_box_text_new (); g_signal_connect (priv->version_selector, "changed", @@ -1520,19 +1442,14 @@ logview_window_init (LogviewWindow *logview) G_CALLBACK (tearoff_changed_cb), logview); g_signal_connect (priv->manager, "active-changed", G_CALLBACK (active_log_changed_cb), logview); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_signal_connect (logview, "style-set", - G_CALLBACK (style_set_cb), logview); -#endif g_signal_connect (logview, "key-press-event", G_CALLBACK (key_press_event_cb), logview); /* status area at bottom */ priv->statusbar = gtk_statusbar_new (); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_margin_top (GTK_WIDGET (logview->priv->statusbar), 0); gtk_widget_set_margin_bottom (GTK_WIDGET (logview->priv->statusbar), 0); -#endif + gtk_box_pack_start (GTK_BOX (vbox), priv->statusbar, FALSE, FALSE, 0); gtk_widget_show (priv->statusbar); diff --git a/mate-dictionary/libgdict/gdict-database-chooser.c b/mate-dictionary/libgdict/gdict-database-chooser.c index 22c9aadb..37572abe 100644 --- a/mate-dictionary/libgdict/gdict-database-chooser.c +++ b/mate-dictionary/libgdict/gdict-database-chooser.c @@ -190,11 +190,7 @@ gdict_database_chooser_dispose (GObject *gobject) if (priv->busy_cursor) { -#if GTK_CHECK_VERSION (3, 0, 0) g_object_unref (priv->busy_cursor); -#else - gdk_cursor_unref (priv->busy_cursor); -#endif priv->busy_cursor = NULL; } @@ -338,17 +334,8 @@ gdict_database_chooser_constructor (GType type, chooser = GDICT_DATABASE_CHOOSER (object); priv = chooser->priv; -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_push_composite_child (); -#endif - sw = gtk_scrolled_window_new (NULL, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_vexpand (sw, TRUE); -#endif -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (sw, "gdict-database-chooser-scrolled-window"); -#endif gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -364,9 +351,6 @@ gdict_database_chooser_constructor (GType type, "weight", DB_COLUMN_CURRENT, NULL); priv->treeview = gtk_tree_view_new (); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (priv->treeview, "gdict-database-chooser-treeview"); -#endif gtk_tree_view_set_model (GTK_TREE_VIEW (priv->treeview), GTK_TREE_MODEL (priv->store)); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->treeview), FALSE); @@ -379,11 +363,7 @@ gdict_database_chooser_constructor (GType type, gtk_container_add (GTK_CONTAINER (sw), priv->treeview); gtk_widget_show (priv->treeview); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif priv->buttons_box = hbox; priv->refresh_button = gtk_button_new (); @@ -413,10 +393,6 @@ gdict_database_chooser_constructor (GType type, gtk_box_pack_end (GTK_BOX (chooser), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_pop_composite_child (); -#endif - return object; } @@ -733,15 +709,11 @@ lookup_start_cb (GdictContext *context, GdictDatabaseChooserPrivate *priv = chooser->priv; if (!priv->busy_cursor) -#if GTK_CHECK_VERSION(3,0,0) { GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (chooser)); priv->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH); } -#else - priv->busy_cursor = gdk_cursor_new (GDK_WATCH); -#endif if (gtk_widget_get_window (GTK_WIDGET (chooser))) gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (chooser)), priv->busy_cursor); diff --git a/mate-dictionary/libgdict/gdict-defbox.c b/mate-dictionary/libgdict/gdict-defbox.c index 7ce0cb57..29c304f9 100644 --- a/mate-dictionary/libgdict/gdict-defbox.c +++ b/mate-dictionary/libgdict/gdict-defbox.c @@ -52,10 +52,6 @@ #define QUERY_MARGIN 48 #define ERROR_MARGIN 24 -#if GTK_CHECK_VERSION (3, 0, 0) -#define gdk_cursor_unref g_object_unref -#endif - typedef struct { GdictDefinition *definition; @@ -63,11 +59,6 @@ typedef struct gint begin; } Definition; -#if !GTK_CHECK_VERSION(3,0,0) -#define GDICT_DEFBOX_GET_PRIVATE(obj) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GDICT_TYPE_DEFBOX, GdictDefboxPrivate)) -#endif - struct _GdictDefboxPrivate { GtkWidget *text_view; @@ -131,16 +122,8 @@ enum }; static guint gdict_defbox_signals[LAST_SIGNAL] = { 0 }; -#if GTK_CHECK_VERSION(3,0,0) -G_DEFINE_TYPE_WITH_PRIVATE (GdictDefbox, gdict_defbox, GTK_TYPE_BOX) -#else -static GdkColor default_link_color = { 0, 0, 0, 0xeeee }; -static GdkColor default_visited_link_color = { 0, 0x5555, 0x1a1a, 0x8b8b }; - - -G_DEFINE_TYPE (GdictDefbox, gdict_defbox, GTK_TYPE_BOX); -#endif +G_DEFINE_TYPE_WITH_PRIVATE (GdictDefbox, gdict_defbox, GTK_TYPE_BOX) static Definition * definition_new (void) @@ -201,19 +184,19 @@ gdict_defbox_dispose (GObject *gobject) if (priv->busy_cursor) { - gdk_cursor_unref (priv->busy_cursor); + g_object_unref (priv->busy_cursor); priv->busy_cursor = NULL; } if (priv->hand_cursor) { - gdk_cursor_unref (priv->hand_cursor); + g_object_unref (priv->hand_cursor); priv->hand_cursor = NULL; } if (priv->regular_cursor) { - gdk_cursor_unref (priv->regular_cursor); + g_object_unref (priv->regular_cursor); priv->regular_cursor = NULL; } @@ -1309,18 +1292,10 @@ create_find_pane (GdictDefbox *defbox) priv = defbox->priv; -#if GTK_CHECK_VERSION (3, 0, 0) find_pane = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - find_pane = gtk_hbox_new (FALSE, 0); -#endif gtk_container_set_border_width (GTK_CONTAINER (find_pane), 0); -#if GTK_CHECK_VERSION (3, 0, 0) hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - hbox1 = gtk_hbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (find_pane), hbox1, TRUE, TRUE, 0); gtk_widget_show (hbox1); @@ -1334,11 +1309,7 @@ create_find_pane (GdictDefbox *defbox) gtk_box_pack_start (GTK_BOX (hbox1), button, FALSE, FALSE, 0); gtk_widget_show (button); -#if GTK_CHECK_VERSION (3, 0, 0) hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); -#else - hbox2 = gtk_hbox_new (FALSE, 12); -#endif gtk_box_pack_start (GTK_BOX (hbox1), hbox2, TRUE, TRUE, 0); gtk_widget_show (hbox2); @@ -1351,11 +1322,7 @@ create_find_pane (GdictDefbox *defbox) gtk_box_pack_start (GTK_BOX (hbox2), priv->find_entry, TRUE, TRUE, 0); gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->find_entry); -#if GTK_CHECK_VERSION (3, 0, 0) sep = gtk_separator_new (GTK_ORIENTATION_VERTICAL); -#else - sep = gtk_vseparator_new (); -#endif gtk_box_pack_start (GTK_BOX (hbox1), sep, FALSE, FALSE, 0); gtk_widget_show (sep); @@ -1387,9 +1354,6 @@ static void gdict_defbox_init_tags (GdictDefbox *defbox) { GdictDefboxPrivate *priv = defbox->priv; -#if !GTK_CHECK_VERSION(3,0,0) - GdkColor *link_color, *visited_link_color; -#endif g_assert (GTK_IS_TEXT_BUFFER (priv->buffer)); @@ -1410,7 +1374,6 @@ gdict_defbox_init_tags (GdictDefbox *defbox) "scale", PANGO_SCALE_SMALL, NULL); -#if GTK_CHECK_VERSION(3,0,0) { GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (defbox)); gboolean prefer_dark = FALSE; @@ -1443,35 +1406,6 @@ gdict_defbox_init_tags (GdictDefbox *defbox) "foreground-rgba", &rgba, NULL); } -#else - link_color = visited_link_color = NULL; - gtk_widget_style_get (GTK_WIDGET (defbox), - "link-color", &link_color, - "visited-link-color", &visited_link_color, - NULL); - if (!link_color) - link_color = &default_link_color; - - if (!visited_link_color) - visited_link_color = &default_visited_link_color; - - priv->link_tag = - gtk_text_buffer_create_tag (priv->buffer, "link", - "underline", PANGO_UNDERLINE_SINGLE, - "foreground-gdk", link_color, - NULL); - priv->visited_link_tag = - gtk_text_buffer_create_tag (priv->buffer, "visited-link", - "underline", PANGO_UNDERLINE_SINGLE, - "foreground-gdk", visited_link_color, - NULL); - - if (link_color != &default_link_color) - gdk_color_free (link_color); - - if (visited_link_color != &default_visited_link_color) - gdk_color_free (visited_link_color); -#endif gtk_text_buffer_create_tag (priv->buffer, "phonetic", "foreground", "dark gray", @@ -1594,24 +1528,16 @@ set_cursor_if_appropriate (GdictDefbox *defbox, priv = defbox->priv; if (!priv->hand_cursor) -#if GTK_CHECK_VERSION(3,0,0) { GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (defbox)); priv->hand_cursor = gdk_cursor_new_for_display (display, GDK_HAND2); } -#else - priv->hand_cursor = gdk_cursor_new (GDK_HAND2); -#endif if (!priv->regular_cursor) -#if GTK_CHECK_VERSION(3,0,0) { GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (defbox)); priv->regular_cursor = gdk_cursor_new_for_display (display, GDK_XTERM); } -#else - priv->regular_cursor = gdk_cursor_new (GDK_XTERM); -#endif gtk_text_view_get_iter_at_location (text_view, &iter, x, y); @@ -1667,10 +1593,6 @@ defbox_motion_notify_cb (GtkWidget *text_view, set_cursor_if_appropriate (defbox, GTK_TEXT_VIEW (text_view), bx, by); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_window_get_pointer (gtk_widget_get_window (text_view), NULL, NULL, NULL); -#endif - return FALSE; } @@ -1679,22 +1601,16 @@ defbox_visibility_notify_cb (GtkWidget *text_view, GdkEventVisibility *event, GdictDefbox *defbox) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkDisplay *display; GdkDeviceManager *device_manager; GdkDevice *pointer; -#endif gint wx, wy; gint bx, by; -#if GTK_CHECK_VERSION (3, 0, 0) display = gdk_window_get_display (event->window); device_manager = gdk_display_get_device_manager (display); pointer = gdk_device_manager_get_client_pointer (device_manager); gdk_window_get_device_position (gtk_widget_get_window (text_view), pointer, &wx, &wy, NULL); -#else - gdk_window_get_pointer (gtk_widget_get_window (text_view), &wx, &wy, NULL); -#endif gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view), GTK_TEXT_WINDOW_WIDGET, @@ -1722,17 +1638,8 @@ gdict_defbox_constructor (GType type, defbox = GDICT_DEFBOX (object); priv = defbox->priv; -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_push_composite_child (); -#endif - sw = gtk_scrolled_window_new (NULL, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_vexpand (sw, TRUE); -#endif -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (sw, "gdict-defbox-scrolled-window"); -#endif gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -1745,18 +1652,12 @@ gdict_defbox_constructor (GType type, gdict_defbox_init_tags (defbox); priv->text_view = gtk_text_view_new_with_buffer (priv->buffer); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (priv->text_view, "gdict-defbox-text-view"); -#endif gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->text_view), FALSE); gtk_text_view_set_left_margin (GTK_TEXT_VIEW (priv->text_view), 4); gtk_container_add (GTK_CONTAINER (sw), priv->text_view); gtk_widget_show (priv->text_view); priv->find_pane = create_find_pane (defbox); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (priv->find_pane, "gdict-defbox-find-pane"); -#endif gtk_box_pack_end (GTK_BOX (defbox), priv->find_pane, FALSE, FALSE, 0); /* stuff to make the link machinery work */ @@ -1770,51 +1671,9 @@ gdict_defbox_constructor (GType type, G_CALLBACK (defbox_visibility_notify_cb), defbox); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_pop_composite_child (); -#endif - return object; } -#if !GTK_CHECK_VERSION(3,0,0) -static void -gdict_defbox_style_set (GtkWidget *widget, - GtkStyle *old_style) -{ - GdictDefboxPrivate *priv = GDICT_DEFBOX (widget)->priv; - GdkColor *link_color, *visited_link_color; - - if (GTK_WIDGET_CLASS (gdict_defbox_parent_class)->style_set) - GTK_WIDGET_CLASS (gdict_defbox_parent_class)->style_set (widget, old_style); - - link_color = visited_link_color = NULL; - gtk_widget_style_get (widget, - "link-color", &link_color, - "visited-link-color", &visited_link_color, - NULL); - if (!link_color) - link_color = &default_link_color; - - if (!visited_link_color) - visited_link_color = &default_visited_link_color; - - g_object_set (G_OBJECT (priv->link_tag), - "foreground-gdk", link_color, - NULL); - - g_object_set (G_OBJECT (priv->visited_link_tag), - "foreground-gdk", visited_link_color, - NULL); - - if (link_color != &default_link_color) - gdk_color_free (link_color); - - if (visited_link_color != &default_visited_link_color) - gdk_color_free (visited_link_color); -} -#endif - /* we override the GtkWidget::show_all method since we have widgets * we don't want to show, such as the find pane */ @@ -1884,9 +1743,6 @@ gdict_defbox_class_init (GdictDefboxClass *klass) gobject_class->finalize = gdict_defbox_finalize; widget_class->show_all = gdict_defbox_show_all; -#if !GTK_CHECK_VERSION(3,0,0) - widget_class->style_set = gdict_defbox_style_set; -#endif /** * GdictDefbox:word: @@ -2011,10 +1867,6 @@ gdict_defbox_class_init (GdictDefboxClass *klass) GDK_KEY_Escape, 0, "hide-find", 0); - -#if !GTK_CHECK_VERSION(3,0,0) - g_type_class_add_private (klass, sizeof (GdictDefboxPrivate)); -#endif } static void @@ -2025,11 +1877,7 @@ gdict_defbox_init (GdictDefbox *defbox) gtk_orientable_set_orientation (GTK_ORIENTABLE (defbox), GTK_ORIENTATION_VERTICAL); gtk_box_set_spacing (GTK_BOX (defbox), 6); -#if GTK_CHECK_VERSION(3,0,0) priv = gdict_defbox_get_instance_private (defbox); -#else - priv = GDICT_DEFBOX_GET_PRIVATE (defbox); -#endif defbox->priv = priv; priv->context = NULL; @@ -2262,14 +2110,10 @@ lookup_start_cb (GdictContext *context, priv->is_searching = TRUE; if (!priv->busy_cursor) -#if GTK_CHECK_VERSION(3,0,0) { GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (defbox)); priv->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH); } -#else - priv->busy_cursor = gdk_cursor_new (GDK_WATCH); -#endif window = gtk_text_view_get_window (GTK_TEXT_VIEW (priv->text_view), GTK_TEXT_WINDOW_WIDGET); @@ -2975,11 +2819,7 @@ gdict_defbox_set_font_name (GdictDefbox *defbox, else font_desc = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_override_font (priv->text_view, font_desc); -#else - gtk_widget_modify_font (priv->text_view, font_desc); -#endif if (font_desc) pango_font_description_free (font_desc); diff --git a/mate-dictionary/libgdict/gdict-source-chooser.c b/mate-dictionary/libgdict/gdict-source-chooser.c index 217bf412..54b77f4e 100644 --- a/mate-dictionary/libgdict/gdict-source-chooser.c +++ b/mate-dictionary/libgdict/gdict-source-chooser.c @@ -47,13 +47,6 @@ #include "gdict-enum-types.h" #include "gdict-marshal.h" -#if !GTK_CHECK_VERSION(3,0,0) -#define GDICT_SOURCE_CHOOSER_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - GDICT_TYPE_SOURCE_CHOOSER, \ - GdictSourceChooserPrivate)) -#endif - struct _GdictSourceChooserPrivate { GtkListStore *store; @@ -65,10 +58,6 @@ struct _GdictSourceChooserPrivate GdictSourceLoader *loader; gint n_sources; -#if !GTK_CHECK_VERSION(3,0,0) - GdkCursor *busy_cursor; -#endif - gchar *current_source; }; @@ -100,11 +89,7 @@ enum static guint source_chooser_signals[LAST_SIGNAL] = { 0, }; -#if GTK_CHECK_VERSION(3,0,0) G_DEFINE_TYPE_WITH_PRIVATE (GdictSourceChooser, gdict_source_chooser, GTK_TYPE_BOX) -#else -G_DEFINE_TYPE (GdictSourceChooser, gdict_source_chooser, GTK_TYPE_BOX); -#endif static void gdict_source_chooser_finalize (GObject *gobject) @@ -135,14 +120,6 @@ gdict_source_chooser_dispose (GObject *gobject) priv->loader = NULL; } -#if !GTK_CHECK_VERSION(3,0,0) - if (priv->busy_cursor) - { - gdk_cursor_unref (priv->busy_cursor); - priv->busy_cursor = NULL; - } -#endif - G_OBJECT_CLASS (gdict_source_chooser_parent_class)->dispose (gobject); } @@ -260,17 +237,8 @@ gdict_source_chooser_constructor (GType gtype, chooser = GDICT_SOURCE_CHOOSER (retval); priv = chooser->priv; -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_push_composite_child (); -#endif - sw = gtk_scrolled_window_new (NULL, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_vexpand (sw, TRUE); -#endif -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (sw, "gdict-source-chooser-scrolled-window"); -#endif gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -286,9 +254,6 @@ gdict_source_chooser_constructor (GType gtype, "weight", SOURCE_CURRENT, NULL); priv->treeview = gtk_tree_view_new (); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (priv->treeview, "gdict-source-chooser-treeview"); -#endif gtk_tree_view_set_model (GTK_TREE_VIEW (priv->treeview), GTK_TREE_MODEL (priv->store)); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->treeview), FALSE); @@ -302,11 +267,7 @@ gdict_source_chooser_constructor (GType gtype, gtk_container_add (GTK_CONTAINER (sw), priv->treeview); gtk_widget_show (priv->treeview); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - hbox = gtk_hbox_new (FALSE, 6); -#endif priv->buttons_box = hbox; priv->refresh_button = gtk_button_new (); @@ -324,10 +285,6 @@ gdict_source_chooser_constructor (GType gtype, gtk_box_pack_end (GTK_BOX (chooser), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_pop_composite_child (); -#endif - return retval; } @@ -336,10 +293,6 @@ gdict_source_chooser_class_init (GdictSourceChooserClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); -#if !GTK_CHECK_VERSION(3,0,0) - g_type_class_add_private (klass, sizeof (GdictSourceChooserPrivate)); -#endif - gobject_class->finalize = gdict_source_chooser_finalize; gobject_class->dispose = gdict_source_chooser_dispose; gobject_class->set_property = gdict_source_chooser_set_property; @@ -423,11 +376,7 @@ gdict_source_chooser_init (GdictSourceChooser *chooser) { GdictSourceChooserPrivate *priv; -#if GTK_CHECK_VERSION(3,0,0) chooser->priv = priv = gdict_source_chooser_get_instance_private (chooser); -#else - chooser->priv = priv = GDICT_SOURCE_CHOOSER_GET_PRIVATE (chooser); -#endif gtk_orientable_set_orientation (GTK_ORIENTABLE (chooser), GTK_ORIENTATION_VERTICAL); @@ -439,10 +388,6 @@ gdict_source_chooser_init (GdictSourceChooser *chooser) priv->loader = NULL; priv->n_sources = -1; - -#if !GTK_CHECK_VERSION(3,0,0) - priv->busy_cursor = gdk_cursor_new (GDK_WATCH); -#endif } /** diff --git a/mate-dictionary/libgdict/gdict-speller.c b/mate-dictionary/libgdict/gdict-speller.c index 1333894c..14bdb0c6 100644 --- a/mate-dictionary/libgdict/gdict-speller.c +++ b/mate-dictionary/libgdict/gdict-speller.c @@ -45,11 +45,6 @@ #include "gdict-debug.h" #include "gdict-private.h" -#if !GTK_CHECK_VERSION(3,0,0) -#define GDICT_SPELLER_GET_PRIVATE(obj) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GDICT_TYPE_SPELLER, GdictSpellerPrivate)) -#endif - struct _GdictSpellerPrivate { GdictContext *context; @@ -110,12 +105,7 @@ enum static guint speller_signals[LAST_SIGNAL] = { 0 }; -#if GTK_CHECK_VERSION(3,0,0) G_DEFINE_TYPE_WITH_PRIVATE (GdictSpeller, gdict_speller, GTK_TYPE_BOX) -#else -G_DEFINE_TYPE (GdictSpeller, gdict_speller, GTK_TYPE_BOX); -#endif - static void set_gdict_context (GdictSpeller *speller, @@ -179,11 +169,7 @@ gdict_speller_finalize (GObject *gobject) set_gdict_context (speller, NULL); if (priv->busy_cursor) -#if GTK_CHECK_VERSION (3, 0, 0) g_object_unref (priv->busy_cursor); -#else - gdk_cursor_unref (priv->busy_cursor); -#endif g_free (priv->strategy); g_free (priv->database); @@ -320,17 +306,8 @@ gdict_speller_constructor (GType type, speller = GDICT_SPELLER (object); priv = speller->priv; -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_push_composite_child (); -#endif - sw = gtk_scrolled_window_new (NULL, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_vexpand (sw, TRUE); -#endif -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (sw, "gdict-speller-scrolled-window"); -#endif gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -346,9 +323,6 @@ gdict_speller_constructor (GType type, NULL); priv->treeview = gtk_tree_view_new (); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (priv->treeview, "gdict-speller-treeview"); -#endif gtk_tree_view_set_model (GTK_TREE_VIEW (priv->treeview), GTK_TREE_MODEL (priv->store)); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->treeview), FALSE); @@ -358,11 +332,7 @@ gdict_speller_constructor (GType type, gtk_container_add (GTK_CONTAINER (sw), priv->treeview); gtk_widget_show (priv->treeview); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif priv->clear_button = gtk_button_new (); gtk_button_set_image (GTK_BUTTON (priv->clear_button), @@ -379,10 +349,6 @@ gdict_speller_constructor (GType type, gtk_box_pack_end (GTK_BOX (speller), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_pop_composite_child (); -#endif - return object; } @@ -428,10 +394,6 @@ gdict_speller_class_init (GdictSpellerClass *klass) G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); - -#if !GTK_CHECK_VERSION(3,0,0) - g_type_class_add_private (gobject_class, sizeof (GdictSpellerPrivate)); -#endif } static void @@ -439,11 +401,7 @@ gdict_speller_init (GdictSpeller *speller) { GdictSpellerPrivate *priv; -#if GTK_CHECK_VERSION(3,0,0) speller->priv = priv = gdict_speller_get_instance_private (speller); -#else - speller->priv = priv = GDICT_SPELLER_GET_PRIVATE (speller); -#endif gtk_orientable_set_orientation (GTK_ORIENTABLE (speller), GTK_ORIENTATION_VERTICAL); @@ -664,14 +622,10 @@ lookup_start_cb (GdictContext *context, GdictSpellerPrivate *priv = speller->priv; if (!priv->busy_cursor) -#if GTK_CHECK_VERSION(3,0,0) { GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (speller)); priv->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH); } -#else - priv->busy_cursor = gdk_cursor_new (GDK_WATCH); -#endif if (gtk_widget_get_window (GTK_WIDGET (speller))) gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (speller)), priv->busy_cursor); diff --git a/mate-dictionary/libgdict/gdict-strategy-chooser.c b/mate-dictionary/libgdict/gdict-strategy-chooser.c index 9e6d0b1c..4b6f1ecd 100644 --- a/mate-dictionary/libgdict/gdict-strategy-chooser.c +++ b/mate-dictionary/libgdict/gdict-strategy-chooser.c @@ -45,11 +45,6 @@ #include "gdict-enum-types.h" #include "gdict-marshal.h" -#if !GTK_CHECK_VERSION(3,0,0) -#define GDICT_STRATEGY_CHOOSER_GET_PRIVATE(obj) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GDICT_TYPE_STRATEGY_CHOOSER, GdictStrategyChooserPrivate)) -#endif - struct _GdictStrategyChooserPrivate { GtkListStore *store; @@ -108,16 +103,9 @@ enum static guint db_chooser_signals[LAST_SIGNAL] = { 0 }; -#if GTK_CHECK_VERSION(3,0,0) G_DEFINE_TYPE_WITH_PRIVATE (GdictStrategyChooser, gdict_strategy_chooser, GTK_TYPE_BOX); -#else -G_DEFINE_TYPE (GdictStrategyChooser, - gdict_strategy_chooser, - GTK_TYPE_BOX); -#endif - static void set_gdict_context (GdictStrategyChooser *chooser, @@ -184,11 +172,7 @@ gdict_strategy_chooser_dispose (GObject *gobject) if (priv->busy_cursor) { -#if GTK_CHECK_VERSION (3, 0, 0) g_object_unref (priv->busy_cursor); -#else - gdk_cursor_unref (priv->busy_cursor); -#endif priv->busy_cursor = NULL; } @@ -333,17 +317,8 @@ gdict_strategy_chooser_constructor (GType type, chooser = GDICT_STRATEGY_CHOOSER (object); priv = chooser->priv; -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_push_composite_child (); -#endif - sw = gtk_scrolled_window_new (NULL, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_vexpand (sw, TRUE); -#endif -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (sw, "gdict-strategy-chooser-scrolled-window"); -#endif gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -359,9 +334,6 @@ gdict_strategy_chooser_constructor (GType type, "weight", STRAT_COLUMN_CURRENT, NULL); priv->treeview = gtk_tree_view_new (); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_composite_name (priv->treeview, "gdict-strategy-chooser-treeview"); -#endif gtk_tree_view_set_model (GTK_TREE_VIEW (priv->treeview), GTK_TREE_MODEL (priv->store)); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->treeview), FALSE); @@ -371,11 +343,7 @@ gdict_strategy_chooser_constructor (GType type, gtk_container_add (GTK_CONTAINER (sw), priv->treeview); gtk_widget_show (priv->treeview); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif priv->refresh_button = gtk_button_new (); gtk_button_set_image (GTK_BUTTON (priv->refresh_button), @@ -404,10 +372,6 @@ gdict_strategy_chooser_constructor (GType type, gtk_box_pack_end (GTK_BOX (chooser), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_pop_composite_child (); -#endif - return object; } @@ -455,10 +419,6 @@ gdict_strategy_chooser_class_init (GdictStrategyChooserClass *klass) G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); - -#if !GTK_CHECK_VERSION(3,0,0) - g_type_class_add_private (gobject_class, sizeof (GdictStrategyChooserPrivate)); -#endif } static void @@ -466,11 +426,7 @@ gdict_strategy_chooser_init (GdictStrategyChooser *chooser) { GdictStrategyChooserPrivate *priv; -#if GTK_CHECK_VERSION(3,0,0) chooser->priv = priv = gdict_strategy_chooser_get_instance_private (chooser); -#else - chooser->priv = priv = GDICT_STRATEGY_CHOOSER_GET_PRIVATE (chooser); -#endif gtk_orientable_set_orientation (GTK_ORIENTABLE (chooser), GTK_ORIENTATION_VERTICAL); @@ -696,14 +652,10 @@ lookup_start_cb (GdictContext *context, GdictStrategyChooserPrivate *priv = chooser->priv; if (!priv->busy_cursor) -#if GTK_CHECK_VERSION(3,0,0) { GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (chooser)); priv->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH); } -#else - priv->busy_cursor = gdk_cursor_new (GDK_WATCH); -#endif if (gtk_widget_get_window (GTK_WIDGET (chooser))) gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (chooser)), priv->busy_cursor); diff --git a/mate-dictionary/libgdict/mate-dict.pc.in b/mate-dictionary/libgdict/mate-dict.pc.in index 8168de2d..0be2fede 100644 --- a/mate-dictionary/libgdict/mate-dict.pc.in +++ b/mate-dictionary/libgdict/mate-dict.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: gdict-1.0 Description: MATE Dictionary Protocol client library -Requires: gtk+-@GTK_API_VERSION@ >= @GTK_REQUIRED@ +Requires: gtk+-3.0 >= @GTK_REQUIRED@ Version: @GDICT_VERSION@ Libs: -L${libdir} -lmatedict Cflags: -I${includedir}/mate-dict diff --git a/mate-dictionary/src/gdict-aligned-window.c b/mate-dictionary/src/gdict-aligned-window.c index c1cb9d53..37c03ca5 100644 --- a/mate-dictionary/src/gdict-aligned-window.c +++ b/mate-dictionary/src/gdict-aligned-window.c @@ -173,11 +173,7 @@ gdict_aligned_window_position (GdictAlignedWindow *window) gdk_flush (); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_get_geometry (gtk_widget_get_window (GTK_WIDGET (window)), NULL, NULL, &our_width, &our_height); -#else - gdk_window_get_geometry (gtk_widget_get_window (GTK_WIDGET (window)), NULL, NULL, &our_width, &our_height, NULL); -#endif /* stick, skip taskbar and pager */ gtk_window_stick (GTK_WINDOW (window)); @@ -191,11 +187,7 @@ gdict_aligned_window_position (GdictAlignedWindow *window) gdk_window_get_origin (gdk_window, &entry_x, &entry_y); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_get_geometry (gdk_window, NULL, NULL, &entry_width, &entry_height); -#else - gdk_window_get_geometry (gdk_window, NULL, NULL, &entry_width, &entry_height, NULL); -#endif if (entry_x + our_width < gdk_screen_width ()) x = entry_x + 1; diff --git a/mate-dictionary/src/gdict-applet.c b/mate-dictionary/src/gdict-applet.c index 424a4c75..cd6133ef 100644 --- a/mate-dictionary/src/gdict-applet.c +++ b/mate-dictionary/src/gdict-applet.c @@ -38,10 +38,6 @@ #include "gdict-common.h" #include "gdict-aligned-window.h" -#if !GTK_CHECK_VERSION(3,0,0) -#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y) -#endif - #define GDICT_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDICT_TYPE_APPLET, GdictAppletClass)) #define GDICT_APPLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDICT_TYPE_APPLET, GdictAppletClass)) @@ -338,11 +334,7 @@ gdict_applet_build_window (GdictApplet *applet) gtk_widget_show (frame); priv->frame = frame; -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); -#else - vbox = gtk_vbox_new (FALSE, 12); -#endif gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_container_add (GTK_CONTAINER (frame), vbox); gtk_widget_show (vbox); @@ -356,11 +348,7 @@ gdict_applet_build_window (GdictApplet *applet) gtk_widget_set_can_focus (priv->defbox, TRUE); gtk_widget_set_can_default (priv->defbox, TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); -#else - bbox = gtk_hbutton_box_new (); -#endif gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END); gtk_box_set_spacing (GTK_BOX (bbox), 6); gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 0); @@ -520,22 +508,7 @@ gdict_applet_draw (GdictApplet *applet) if (priv->box) gtk_widget_destroy (priv->box); -#if GTK_CHECK_VERSION (3, 0, 0) box = gtk_box_new (priv->orient, 0); -#else - switch (priv->orient) - { - case GTK_ORIENTATION_VERTICAL: - box = gtk_vbox_new (FALSE, 0); - break; - case GTK_ORIENTATION_HORIZONTAL: - box = gtk_hbox_new (FALSE, 0); - break; - default: - g_assert_not_reached (); - break; - } -#endif gtk_container_add (GTK_CONTAINER (applet), box); gtk_widget_show (box); @@ -558,11 +531,7 @@ gdict_applet_draw (GdictApplet *applet) gtk_box_pack_start (GTK_BOX (box), priv->toggle, FALSE, FALSE, 0); gtk_widget_show (priv->toggle); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif gtk_container_set_border_width (GTK_CONTAINER (hbox), 0); gtk_container_add (GTK_CONTAINER (priv->toggle), hbox); gtk_widget_show (hbox); diff --git a/mate-dictionary/src/gdict-sidebar.c b/mate-dictionary/src/gdict-sidebar.c index 7ca99fab..1a6e6d4b 100644 --- a/mate-dictionary/src/gdict-sidebar.c +++ b/mate-dictionary/src/gdict-sidebar.c @@ -36,10 +36,6 @@ #include "gdict-sidebar.h" -#if !GTK_CHECK_VERSION(3,0,0) -#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y) -#endif - typedef struct { guint index; @@ -332,11 +328,7 @@ gdict_sidebar_init (GdictSidebar *sidebar) priv->pages_by_id = g_hash_table_new (g_str_hash, g_str_equal); /* top option menu */ -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif gtk_box_pack_start (GTK_BOX (sidebar), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); priv->hbox = hbox; @@ -351,11 +343,7 @@ gdict_sidebar_init (GdictSidebar *sidebar) sidebar); priv->select_button = select_button; -#if GTK_CHECK_VERSION (3, 0, 0) select_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - select_hbox = gtk_hbox_new (FALSE, 0); -#endif priv->label = gtk_label_new (NULL); #if GTK_CHECK_VERSION (3, 16, 0) @@ -367,11 +355,7 @@ gdict_sidebar_init (GdictSidebar *sidebar) gtk_box_pack_start (GTK_BOX (select_hbox), priv->label, FALSE, FALSE, 0); gtk_widget_show (priv->label); -#if GTK_CHECK_VERSION (3, 0, 0) arrow = gtk_image_new_from_icon_name ("go-down-symbolic", GTK_ICON_SIZE_BUTTON); -#else - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); -#endif gtk_box_pack_end (GTK_BOX (select_hbox), arrow, FALSE, FALSE, 0); gtk_widget_show (arrow); diff --git a/mate-dictionary/src/gdict-source-dialog.c b/mate-dictionary/src/gdict-source-dialog.c index 223f54a1..502f1578 100644 --- a/mate-dictionary/src/gdict-source-dialog.c +++ b/mate-dictionary/src/gdict-source-dialog.c @@ -582,10 +582,6 @@ gdict_source_dialog_constructor (GType type, gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_push_composite_child (); -#endif - /* get the UI from the GtkBuilder file */ dialog->builder = gtk_builder_new (); gtk_builder_add_from_file (dialog->builder, GDICT_SOURCE_UI, &error); @@ -673,10 +669,6 @@ gdict_source_dialog_constructor (GType type, */ update_dialog_ui (dialog); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_pop_composite_child (); -#endif - return object; } diff --git a/mate-dictionary/src/gdict-window.c b/mate-dictionary/src/gdict-window.c index 3c716080..026cb9e9 100644 --- a/mate-dictionary/src/gdict-window.c +++ b/mate-dictionary/src/gdict-window.c @@ -56,15 +56,6 @@ #define GDICT_SIDEBAR_STRATEGIES_PAGE "strat-chooser" #define GDICT_SIDEBAR_SOURCES_PAGE "source-chooser" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - -#if !GTK_CHECK_VERSION(3,0,0) -#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y) -#endif - enum { COMPLETION_TEXT_COLUMN, @@ -197,11 +188,7 @@ gdict_window_dispose (GObject *gobject) if (window->busy_cursor) { -#if GTK_CHECK_VERSION (3, 0, 0) g_object_unref (window->busy_cursor); -#else - gdk_cursor_unref (window->busy_cursor); -#endif window->busy_cursor = NULL; } @@ -1618,82 +1605,6 @@ gdict_window_size_allocate (GtkWidget *widget, allocation); } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -set_window_default_size (GdictWindow *window) -{ - GtkWidget *widget; - gboolean is_maximized; - gint width, height; - gint font_size; - GdkScreen *screen; - gint monitor_num; - GtkRequisition req; - GdkRectangle monitor; - - g_assert (GDICT_IS_WINDOW (window)); - - widget = GTK_WIDGET (window); - - /* make sure that the widget is realized */ - /*Do this implicitly in GTK3.21 or segfault results */ - gtk_widget_realize (widget); - /* XXX - the user wants mate-dictionary to resize itself, so - * we compute the minimum safe geometry needed for displaying - * the text returned by a dictionary server, which is based - * on the font size and the ANSI terminal. this is dumb, - * I know, but dictionary servers return pre-formatted text - * and we can't reformat it ourselves. - */ - if (window->default_width == -1 || window->default_height == -1) - { - /* Size based on the font size */ - GtkWidget *defbox = window->defbox; - gint width, height; - - font_size = pango_font_description_get_size (gtk_widget_get_style (defbox)->font_desc); - font_size = PANGO_PIXELS (font_size); - - width = font_size * GDICT_WINDOW_COLUMNS; - height = font_size * GDICT_WINDOW_ROWS; - - /* Use at least the requisition size of the window... */ - gtk_widget_get_preferred_size (widget, NULL, &req); - width = MAX (width, req.width); - height = MAX (height, req.height); - - /* ... but make it no larger than the monitor */ - screen = gtk_widget_get_screen (widget); - monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget)); - - gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); - width = MIN (width, monitor.width * 3 / 4); - height = MIN (height, monitor.height * 3 / 4); - - window->default_width = width; - window->default_height = height; - } - - /* Set default size */ - gtk_window_set_default_size (GTK_WINDOW (widget), - window->default_width, - window->default_height); - - if (window->is_maximized) - gtk_window_maximize (GTK_WINDOW (widget)); -} - -static void -gdict_window_style_set (GtkWidget *widget, - GtkStyle *old_style) -{ - - if (GTK_WIDGET_CLASS (gdict_window_parent_class)->style_set) - GTK_WIDGET_CLASS (gdict_window_parent_class)->style_set (widget, old_style); - - set_window_default_size (GDICT_WINDOW (widget)); -} -#endif static void gdict_window_handle_notify_position_cb (GtkWidget *widget, GParamSpec *pspec, @@ -1740,11 +1651,7 @@ gdict_window_constructor (GType type, /* recover the state */ gdict_window_load_state (window); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_push_composite_child (); -#endif - - window->main_box = gtk_vbox_new (FALSE, 0); + window->main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), window->main_box); gtk_widget_show (window->main_box); @@ -1783,12 +1690,12 @@ gdict_window_constructor (GType type, gdict_window_ensure_menu_state (window); } - vbox = gtk_vbox_new (FALSE, 6); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_container_add (GTK_CONTAINER (window->main_box), vbox); gtk_widget_show (vbox); - hbox = gtk_hbox_new (FALSE, 12); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); @@ -1822,16 +1729,12 @@ gdict_window_constructor (GType type, gtk_box_pack_start (GTK_BOX (hbox), window->entry, TRUE, TRUE, 0); gtk_widget_show (window->entry); -#if GTK_CHECK_VERSION (3, 0, 0) handle = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); -#else - handle = gtk_hpaned_new (); -#endif gtk_box_pack_start (GTK_BOX (vbox), handle, TRUE, TRUE, 0); gtk_widget_show (handle); - frame1 = gtk_vbox_new (FALSE, 0); - frame2 = gtk_vbox_new (FALSE, 0); + frame1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + frame2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); window->defbox = gdict_defbox_new (); if (window->context) @@ -2016,10 +1919,6 @@ gdict_window_constructor (GType type, gtk_widget_grab_focus (window->entry); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_pop_composite_child (); -#endif - window->in_construction = FALSE; return object; @@ -2120,9 +2019,6 @@ gdict_window_class_init (GdictWindowClass *klass) LAST_PROP, gdict_window_properties); -#if !GTK_CHECK_VERSION (3, 0, 0) - widget_class->style_set = gdict_window_style_set; -#endif widget_class->size_allocate = gdict_window_size_allocate; } diff --git a/mate-screenshot/data/Makefile.am b/mate-screenshot/data/Makefile.am index 3f26d30c..e3f8623e 100644 --- a/mate-screenshot/data/Makefile.am +++ b/mate-screenshot/data/Makefile.am @@ -5,8 +5,7 @@ mate_screenshot_DATA = $(mate_screenshot_in_files:.desktop.in=.desktop) man_MANS = mate-screenshot.1 uidir = $(datadir)/mate-screenshot -ui_DATA = mate-screenshot.ui \ - mate-screenshot-gtk3.ui +ui_DATA = mate-screenshot-gtk3.ui @INTLTOOL_XML_RULE@ appdatadir = $(datadir)/appdata diff --git a/mate-screenshot/data/mate-screenshot.ui b/mate-screenshot/data/mate-screenshot.ui deleted file mode 100644 index 80382ed4..00000000 --- a/mate-screenshot/data/mate-screenshot.ui +++ /dev/null @@ -1,251 +0,0 @@ -<?xml version="1.0"?> -<!--*- mode: xml -*--> -<interface> - <object class="GtkDialog" id="toplevel"> - <property name="border_width">5</property> - <property name="title" translatable="yes">Save Screenshot</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">False</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <signal handler="on_toplevel_key_press_event" last_modification_time="Thu, 21 Oct 2004 13:29:25 GMT" name="key_press_event"/> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <child> - <object class="GtkButton" id="help_button"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-help</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </object> - </child> - <child> - <object class="GtkButton" id="copy_button"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="use_underline">True</property> - <property name="label" translatable="yes">C_opy to Clipboard</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <accelerator key="C" modifiers="GDK_CONTROL_MASK" signal="activate"/> - </object> - </child> - <child> - <object class="GtkButton" id="cancel_button"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </object> - </child> - <child> - <object class="GtkButton" id="ok_button"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-save</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </object> - </child> - </object> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox3"> - <property name="border_width">5</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">18</property> - <child> - <object class="GtkHBox" id="hbox6"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - <child> - <object class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - <child> - <object class="GtkAspectFrame" id="aspect_frame"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="ratio">1</property> - <property name="obey_child">True</property> - <child> - <object class="GtkDrawingArea" id="preview_darea"> - <property name="visible">True</property> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - <child> - <object class="GtkTable" id="table1"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Name:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">filename_entry</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"/> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">Save in _folder:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"/> - </packing> - </child> - <child> - <object class="GtkEntry" id="filename_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"/> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">True</property> - <property name="width_chars">32</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_options"/> - </packing> - </child> - <child> - <object class="GtkHBox" id="file_chooser_box"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </object> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </object> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </object> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </object> - </child> - <action-widgets> - <action-widget response="-11">help_button</action-widget> - <action-widget response="-6">cancel_button</action-widget> - <action-widget response="-5">ok_button</action-widget> - <action-widget response="1">copy_button</action-widget> - </action-widgets> - </object> -</interface> diff --git a/mate-screenshot/src/mate-screenshot.c b/mate-screenshot/src/mate-screenshot.c index c51bebee..2a8d0db0 100644 --- a/mate-screenshot/src/mate-screenshot.c +++ b/mate-screenshot/src/mate-screenshot.c @@ -315,19 +315,12 @@ create_effects_frame (GtkWidget *outer_vbox, const gchar *frame_title) { GtkWidget *main_vbox, *vbox, *hbox; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkWidget *align; -#endif GtkWidget *label; GtkWidget *check; GtkWidget *combo; gchar *title; -#if GTK_CHECK_VERSION (3, 0, 0) main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - main_vbox = gtk_vbox_new (FALSE, 6); -#endif gtk_widget_set_sensitive (main_vbox, !take_area_shot); gtk_box_pack_start (GTK_BOX (outer_vbox), main_vbox, FALSE, FALSE, 0); gtk_widget_show (main_vbox); @@ -346,30 +339,13 @@ create_effects_frame (GtkWidget *outer_vbox, gtk_widget_show (label); g_free (title); -#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 (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); -#if !GTK_CHECK_VERSION (3, 0, 0) - align = gtk_alignment_new (0.0, 0.0, 0.0, 0.0); - gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 12, 0); - gtk_box_pack_start (GTK_BOX (hbox), align, FALSE, FALSE, 0); - gtk_widget_show (align); -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_widget_set_margin_start (vbox, 12); -#else - vbox = gtk_vbox_new (FALSE, 6); - gtk_container_add (GTK_CONTAINER (align), vbox); -#endif - gtk_widget_show (vbox); /** Include pointer **/ @@ -393,11 +369,7 @@ create_effects_frame (GtkWidget *outer_vbox, border_check = check; /** Effects **/ -#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 (vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); @@ -426,9 +398,6 @@ create_screenshot_frame (GtkWidget *outer_vbox, const gchar *frame_title) { GtkWidget *main_vbox, *vbox, *hbox; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkWidget *align; -#endif GtkWidget *radio; GtkWidget *image; GtkWidget *spin; @@ -437,11 +406,7 @@ create_screenshot_frame (GtkWidget *outer_vbox, GSList *group; gchar *title; -#if GTK_CHECK_VERSION (3, 0, 0) main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - main_vbox = gtk_vbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (outer_vbox), main_vbox, FALSE, FALSE, 0); gtk_widget_show (main_vbox); @@ -458,39 +423,18 @@ create_screenshot_frame (GtkWidget *outer_vbox, gtk_widget_show (label); g_free (title); -#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 (main_vbox), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); -#if !GTK_CHECK_VERSION (3, 0, 0) - align = gtk_alignment_new (0.0, 0.0, 0.0, 0.0); - gtk_widget_set_size_request (align, 48, -1); - gtk_box_pack_start (GTK_BOX (hbox), align, FALSE, FALSE, 0); - gtk_widget_show (align); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) image = gtk_image_new_from_icon_name (SCREENSHOOTER_ICON, GTK_ICON_SIZE_DIALOG); gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); gtk_widget_set_valign (image, GTK_ALIGN_START); -#else - image = gtk_image_new_from_stock (SCREENSHOOTER_ICON, - GTK_ICON_SIZE_DIALOG); - gtk_container_add (GTK_CONTAINER (align), image); -#endif - gtk_widget_show (image); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); -#else - vbox = gtk_vbox_new (FALSE, 6); -#endif gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); @@ -531,11 +475,7 @@ create_screenshot_frame (GtkWidget *outer_vbox, gtk_widget_show (radio); /** Grab after delay **/ -#if GTK_CHECK_VERSION (3, 0, 0) delay_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - delay_hbox = gtk_hbox_new (FALSE, 6); -#endif gtk_widget_set_sensitive (delay_hbox, !take_area_shot); gtk_box_pack_start (GTK_BOX (vbox), delay_hbox, FALSE, FALSE, 0); gtk_widget_show (delay_hbox); @@ -594,11 +534,7 @@ create_interactive_dialog (void) gtk_window_set_title (GTK_WINDOW (retval), _("Take Screenshot")); /* main container */ -#if GTK_CHECK_VERSION (3, 0, 0) main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); -#else - main_vbox = gtk_vbox_new (FALSE, 18); -#endif gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 5); gtk_box_pack_start (GTK_BOX (content_area), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); diff --git a/mate-screenshot/src/screenshot-dialog.c b/mate-screenshot/src/screenshot-dialog.c index 2886458a..e66513ef 100644 --- a/mate-screenshot/src/screenshot-dialog.c +++ b/mate-screenshot/src/screenshot-dialog.c @@ -64,7 +64,6 @@ on_toplevel_key_press_event (GtkWidget *widget, return FALSE; } -#if GTK_CHECK_VERSION (3, 0, 0) static void on_preview_draw (GtkWidget *drawing_area, cairo_t *cr, @@ -97,51 +96,6 @@ on_preview_draw (GtkWidget *drawing_area, gtk_style_context_restore (context); } -#else -static void -on_preview_expose_event (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data) -{ - ScreenshotDialog *dialog = data; - GdkPixbuf *pixbuf = NULL; - gboolean free_pixbuf = FALSE; - cairo_t *cr; - /* Stolen from GtkImage. I really should just make the drawing area an - * image some day */ - if (gtk_widget_get_state (drawing_area) != GTK_STATE_NORMAL) - { - GtkIconSource *source; - - source = gtk_icon_source_new (); - gtk_icon_source_set_pixbuf (source, dialog->preview_image); - gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_icon_source_set_size_wildcarded (source, FALSE); - - pixbuf = gtk_style_render_icon (gtk_widget_get_style (drawing_area), - source, - gtk_widget_get_direction (drawing_area), - gtk_widget_get_state (drawing_area), - (GtkIconSize) -1, - drawing_area, - "gtk-image"); - free_pixbuf = TRUE; - gtk_icon_source_free (source); - } - else - { - pixbuf = g_object_ref (dialog->preview_image); - } - - cr = gdk_cairo_create (gtk_widget_get_window (drawing_area)); - gdk_cairo_region (cr, event->region); - cairo_clip (cr); - gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); - cairo_paint (cr); - cairo_destroy (cr); - - g_object_unref (pixbuf); -} -#endif - static gboolean on_preview_button_press_event (GtkWidget *drawing_area, GdkEventButton *event, @@ -168,24 +122,6 @@ on_preview_button_release_event (GtkWidget *drawing_area, return FALSE; } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -on_preview_configure_event (GtkWidget *drawing_area, - GdkEventConfigure *event, - gpointer data) -{ - ScreenshotDialog *dialog = data; - - if (dialog->preview_image) - g_object_unref (G_OBJECT (dialog->preview_image)); - - dialog->preview_image = gdk_pixbuf_scale_simple (dialog->screenshot, - event->width, - event->height, - GDK_INTERP_BILINEAR); -} -#endif - static void drag_data_get (GtkWidget *widget, GdkDragContext *context, @@ -258,11 +194,7 @@ screenshot_dialog_new (GdkPixbuf *screenshot, dialog = g_new0 (ScreenshotDialog, 1); dialog->ui = gtk_builder_new (); -#if GTK_CHECK_VERSION (3, 0, 0) res = gtk_builder_add_from_file (dialog->ui, UIDIR "/mate-screenshot-gtk3.ui", &error); -#else - res = gtk_builder_add_from_file (dialog->ui, UIDIR "/mate-screenshot.ui", &error); -#endif dialog->screenshot = screenshot; @@ -309,16 +241,9 @@ screenshot_dialog_new (GdkPixbuf *screenshot, (gfloat) gdk_pixbuf_get_height (screenshot), FALSE); g_signal_connect (toplevel, "key_press_event", G_CALLBACK (on_toplevel_key_press_event), dialog); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect (preview_darea, "draw", G_CALLBACK (on_preview_draw), dialog); -#else - g_signal_connect (preview_darea, "expose_event", G_CALLBACK (on_preview_expose_event), dialog); -#endif g_signal_connect (preview_darea, "button_press_event", G_CALLBACK (on_preview_button_press_event), dialog); g_signal_connect (preview_darea, "button_release_event", G_CALLBACK (on_preview_button_release_event), dialog); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_signal_connect (preview_darea, "configure_event", G_CALLBACK (on_preview_configure_event), dialog); -#endif if (take_window_shot) gtk_frame_set_shadow_type (GTK_FRAME (aspect_frame), GTK_SHADOW_NONE); @@ -438,11 +363,7 @@ screenshot_dialog_set_busy (ScreenshotDialog *dialog, /* Change cursor to busy */ cursor = gdk_cursor_new_for_display (display, GDK_WATCH); gdk_window_set_cursor (gtk_widget_get_window (toplevel), cursor); -#if GTK_CHECK_VERSION (3, 0, 0) g_object_unref (cursor); -#else - gdk_cursor_unref (cursor); -#endif } else { diff --git a/mate-screenshot/src/screenshot-utils.c b/mate-screenshot/src/screenshot-utils.c index 4c1f4f7e..5876eeb3 100644 --- a/mate-screenshot/src/screenshot-utils.c +++ b/mate-screenshot/src/screenshot-utils.c @@ -30,18 +30,6 @@ #include <X11/extensions/shape.h> #endif -#if GTK_CHECK_VERSION (3, 0, 0) -#define GdkRegion cairo_region_t -#define gdk_region_new cairo_region_create -#define gdk_region_destroy cairo_region_destroy -#define gdk_region_rectangle cairo_region_create_rectangle -#define gdk_region_offset cairo_region_translate -#define gdk_region_intersect cairo_region_intersect -#define gdk_region_subtract cairo_region_subtract -#define gdk_region_union_with_rect cairo_region_union_rectangle -#define gdk_cursor_unref g_object_unref -#endif - static GtkWidget *selection_window; #define SELECTION_NAME "_MATE_PANEL_SCREENSHOT" @@ -240,26 +228,18 @@ GdkWindow * screenshot_find_current_window () { GdkWindow *current_window; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDeviceManager *manager; GdkDevice *device; -#endif current_window = screenshot_find_active_window (); -#if GTK_CHECK_VERSION (3, 0, 0) manager = gdk_display_get_device_manager (gdk_display_get_default ()); device = gdk_device_manager_get_client_pointer (manager); -#endif /* If there's no active window, we fall back to returning the * window that the cursor is in. */ if (!current_window) -#if GTK_CHECK_VERSION (3, 0, 0) current_window = gdk_device_get_window_at_position (device, NULL, NULL); -#else - current_window = gdk_window_at_pointer (NULL, NULL); -#endif if (current_window) { @@ -330,38 +310,24 @@ select_area_motion_notify (GtkWidget *window, /* Shape the window to make only the outline visible */ if (draw_rect.width > 2 && draw_rect.height > 2) { -#if GTK_CHECK_VERSION (3, 0, 0) cairo_region_t *region, *region2; cairo_rectangle_int_t region_rect = { -#else - GdkRegion *region, *region2; - GdkRectangle region_rect = { -#endif 0, 0, draw_rect.width - 2, draw_rect.height - 2 }; -#if GTK_CHECK_VERSION (3, 0, 0) region = cairo_region_create_rectangle (®ion_rect); -#else - region = gdk_region_rectangle (®ion_rect); -#endif region_rect.x++; region_rect.y++; region_rect.width -= 2; region_rect.height -= 2; -#if GTK_CHECK_VERSION (3, 0, 0) region2 = cairo_region_create_rectangle (®ion_rect); cairo_region_subtract (region, region2); -#else - region2 = gdk_region_rectangle (®ion_rect); - gdk_region_subtract (region, region2); -#endif gdk_window_shape_combine_region (gdkwindow, region, 0, 0); - gdk_region_destroy (region); - gdk_region_destroy (region2); + cairo_region_destroy (region); + cairo_region_destroy (region2); } else gdk_window_shape_combine_region (gdkwindow, NULL, 0, 0); @@ -407,41 +373,18 @@ select_area_key_press (GtkWidget *window, static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) draw (GtkWidget *window, cairo_t *cr, gpointer unused) -#else -expose (GtkWidget *window, GdkEventExpose *event, gpointer unused) -#endif { -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *style; style = gtk_widget_get_style_context (window); -#else - GtkAllocation allocation; - GtkStyle *style; - cairo_t *cr; - - cr = gdk_cairo_create (event->window); - gdk_cairo_region (cr, event->region); - cairo_clip (cr); - - style = gtk_widget_get_style (window); -#endif if (gtk_widget_get_app_paintable (window)) { -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_set_line_width (cr, 1.0); - - gtk_widget_get_allocation (window, &allocation); -#endif - cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); cairo_set_source_rgba (cr, 0, 0, 0, 0); cairo_paint (cr); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_save (style); gtk_style_context_add_class (style, GTK_STYLE_CLASS_RUBBERBAND); @@ -455,27 +398,8 @@ expose (GtkWidget *window, GdkEventExpose *event, gpointer unused) gtk_widget_get_allocated_height (window)); gtk_style_context_restore (style); -#else - cairo_set_operator (cr, CAIRO_OPERATOR_OVER); - gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_SELECTED]); - cairo_paint_with_alpha (cr, 0.25); - - cairo_rectangle (cr, - allocation.x + 0.5, allocation.y + 0.5, - allocation.width - 1, allocation.height - 1); - cairo_stroke (cr); - } - else - { - gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_SELECTED]); - cairo_paint (cr); -#endif } -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif - return TRUE; } @@ -485,27 +409,14 @@ create_select_window (void) GdkScreen *screen = gdk_screen_get_default (); GtkWidget *window = gtk_window_new (GTK_WINDOW_POPUP); -#if GTK_CHECK_VERSION (3, 0, 0) GdkVisual *visual = gdk_screen_get_rgba_visual (screen); if (gdk_screen_is_composited (screen) && visual) { gtk_widget_set_visual (window, visual); gtk_widget_set_app_paintable (window, TRUE); } -#else - GdkColormap *colormap = gdk_screen_get_rgba_colormap (screen); - if (gdk_screen_is_composited (screen) && colormap) - { - gtk_widget_set_colormap (window, colormap); - gtk_widget_set_app_paintable (window, TRUE); - } -#endif -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect (window, "draw", G_CALLBACK (draw), NULL); -#else - g_signal_connect (window, "expose-event", G_CALLBACK (expose), NULL); -#endif gtk_window_move (GTK_WINDOW (window), -100, -100); gtk_window_resize (GTK_WINDOW (window), 10, 10); @@ -535,11 +446,9 @@ screenshot_select_area_async (SelectAreaCallback callback) { GdkDisplay *display; GdkCursor *cursor; -#if GTK_CHECK_VERSION (3, 0, 0) GdkDeviceManager *manager; GdkDevice *pointer, *keyboard; GdkGrabStatus res; -#endif select_area_filter_data data; GdkRectangle *rectangle; CallbackData *cb_data; @@ -562,7 +471,6 @@ screenshot_select_area_async (SelectAreaCallback callback) display = gdk_display_get_default (); cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR); -#if GTK_CHECK_VERSION (3, 0, 0) manager = gdk_display_get_device_manager (display); pointer = gdk_device_manager_get_client_pointer (manager); keyboard = gdk_device_get_associated_device (pointer); @@ -593,42 +501,13 @@ screenshot_select_area_async (SelectAreaCallback callback) goto out; } -#else - - if (gdk_pointer_grab (gtk_widget_get_window (data.window), FALSE, - GDK_POINTER_MOTION_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK, - NULL, cursor, - GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS) - { - gdk_cursor_unref (cursor); - goto out; - } - - if (gdk_keyboard_grab (gtk_widget_get_window (data.window), FALSE, GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS) - { - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gdk_cursor_unref (cursor); - goto out; - } - -#endif - gtk_main (); -#if GTK_CHECK_VERSION (3, 0, 0) - gdk_device_ungrab (keyboard, GDK_CURRENT_TIME); gdk_device_ungrab (pointer, GDK_CURRENT_TIME); -#else - - gdk_keyboard_ungrab (GDK_CURRENT_TIME); - gdk_pointer_ungrab (GDK_CURRENT_TIME); - -#endif - gtk_widget_destroy (data.window); - gdk_cursor_unref (cursor); + g_object_unref (cursor); gdk_flush (); out: @@ -664,39 +543,23 @@ find_wm_window (Window xid) while (TRUE); } -#if GTK_CHECK_VERSION (3, 0, 0) static cairo_region_t * -#else -static GdkRegion * -#endif make_region_with_monitors (GdkScreen *screen) { -#if GTK_CHECK_VERSION (3, 0, 0) cairo_region_t *region; -#else - GdkRegion *region; -#endif int num_monitors; int i; num_monitors = gdk_screen_get_n_monitors (screen); -#if GTK_CHECK_VERSION (3, 0, 0) region = cairo_region_create (); -#else - region = gdk_region_new (); -#endif for (i = 0; i < num_monitors; i++) { GdkRectangle rect; gdk_screen_get_monitor_geometry (screen, i, &rect); -#if GTK_CHECK_VERSION (3, 0, 0) cairo_region_union_rectangle (region, &rect); -#else - gdk_region_union_with_rect (region, &rect); -#endif } return region; @@ -743,7 +606,6 @@ blank_rectangle_in_pixbuf (GdkPixbuf *pixbuf, GdkRectangle *rect) } static void -#if GTK_CHECK_VERSION (3, 0, 0) blank_region_in_pixbuf (GdkPixbuf *pixbuf, cairo_region_t *region) { int n_rects; @@ -752,17 +614,6 @@ blank_region_in_pixbuf (GdkPixbuf *pixbuf, cairo_region_t *region) cairo_rectangle_int_t pixbuf_rect; n_rects = cairo_region_num_rectangles (region); -#else -blank_region_in_pixbuf (GdkPixbuf *pixbuf, GdkRegion *region) -{ - GdkRectangle *rects; - int n_rects; - int i; - int width, height; - GdkRectangle pixbuf_rect; - - gdk_region_get_rectangles (region, &rects, &n_rects); -#endif width = gdk_pixbuf_get_width (pixbuf); height = gdk_pixbuf_get_height (pixbuf); @@ -774,22 +625,13 @@ blank_region_in_pixbuf (GdkPixbuf *pixbuf, GdkRegion *region) for (i = 0; i < n_rects; i++) { -#if GTK_CHECK_VERSION (3, 0, 0) cairo_rectangle_int_t rect, dest; cairo_region_get_rectangle (region, i, &rect); if (gdk_rectangle_intersect (&rect, &pixbuf_rect, &dest)) -#else - GdkRectangle dest; - - if (gdk_rectangle_intersect (rects + i, &pixbuf_rect, &dest)) -#endif blank_rectangle_in_pixbuf (pixbuf, &dest); } -#if !GTK_CHECK_VERSION (3, 0, 0) - g_free (rects); -#endif } /* When there are multiple monitors with different resolutions, the visible area @@ -802,15 +644,9 @@ static void mask_monitors (GdkPixbuf *pixbuf, GdkWindow *root_window) { GdkScreen *screen; -#if GTK_CHECK_VERSION (3, 0, 0) cairo_region_t *region_with_monitors; cairo_region_t *invisible_region; cairo_rectangle_int_t rect; -#else - GdkRegion *region_with_monitors; - GdkRegion *invisible_region; - GdkRectangle rect; -#endif screen = gdk_window_get_screen (root_window); @@ -821,7 +657,6 @@ mask_monitors (GdkPixbuf *pixbuf, GdkWindow *root_window) rect.width = gdk_screen_get_width (screen); rect.height = gdk_screen_get_height (screen); -#if GTK_CHECK_VERSION (3, 0, 0) invisible_region = cairo_region_create_rectangle (&rect); cairo_region_subtract (invisible_region, region_with_monitors); @@ -829,15 +664,6 @@ mask_monitors (GdkPixbuf *pixbuf, GdkWindow *root_window) cairo_region_destroy (region_with_monitors); cairo_region_destroy (invisible_region); -#else - invisible_region = gdk_region_rectangle (&rect); - gdk_region_subtract (invisible_region, region_with_monitors); - - blank_region_in_pixbuf (pixbuf, invisible_region); - - gdk_region_destroy (region_with_monitors); - gdk_region_destroy (invisible_region); -#endif } GdkPixbuf * @@ -905,15 +731,9 @@ screenshot_get_pixbuf (GdkWindow *window, height = rectangle->height; } -#if GTK_CHECK_VERSION (3, 0, 0) screenshot = gdk_pixbuf_get_from_window (root, x_orig, y_orig, width, height); -#else - screenshot = gdk_pixbuf_get_from_drawable (NULL, root, NULL, - x_orig, y_orig, 0, 0, - width, height); -#endif /* * Masking currently only works properly with full-screen shots @@ -1019,20 +839,14 @@ screenshot_get_pixbuf (GdkWindow *window, if (cursor_pixbuf != NULL) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkDeviceManager *manager; GdkDevice *device; -#endif GdkRectangle r1, r2; gint cx, cy, xhot, yhot; -#if GTK_CHECK_VERSION (3, 0, 0) manager = gdk_display_get_device_manager (gdk_display_get_default ()); device = gdk_device_manager_get_client_pointer (manager); gdk_window_get_device_position (window, device, &cx, &cy, NULL); -#else - gdk_window_get_pointer (window, &cx, &cy, NULL); -#endif sscanf (gdk_pixbuf_get_option (cursor_pixbuf, "x_hot"), "%d", &xhot); sscanf (gdk_pixbuf_get_option (cursor_pixbuf, "y_hot"), "%d", &yhot); @@ -1061,7 +875,7 @@ screenshot_get_pixbuf (GdkWindow *window, } g_object_unref (cursor_pixbuf); - gdk_cursor_unref (cursor); + g_object_unref (cursor); } } diff --git a/po/POTFILES.in b/po/POTFILES.in index 386d0033..37089e13 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -65,7 +65,6 @@ mate-dictionary/src/main.c [type: gettext/glade]mate-dictionary/data/mate-dictionary-source.ui mate-screenshot/data/mate-screenshot.appdata.xml.in mate-screenshot/data/mate-screenshot.desktop.in -[type: gettext/glade]mate-screenshot/data/mate-screenshot.ui [type: gettext/glade]mate-screenshot/data/mate-screenshot-gtk3.ui [type: gettext/gsettings]mate-screenshot/data/org.mate.screenshot.gschema.xml.in mate-screenshot/src/mate-screenshot.c |