diff options
Diffstat (limited to 'capplets/common')
-rw-r--r-- | capplets/common/file-transfer-dialog.c | 14 | ||||
-rw-r--r-- | capplets/common/mate-theme-info.c | 44 | ||||
-rw-r--r-- | capplets/common/mate-theme-info.h | 5 | ||||
-rw-r--r-- | capplets/common/theme-thumbnail.c | 149 |
4 files changed, 5 insertions, 207 deletions
diff --git a/capplets/common/file-transfer-dialog.c b/capplets/common/file-transfer-dialog.c index 15f39ae7..a879469e 100644 --- a/capplets/common/file-transfer-dialog.c +++ b/capplets/common/file-transfer-dialog.c @@ -305,11 +305,7 @@ file_transfer_dialog_init (FileTransferDialog *dlg) gtk_widget_set_size_request (GTK_WIDGET (dlg), 350, -1); -#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), 6); gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0); @@ -327,11 +323,7 @@ file_transfer_dialog_init (FileTransferDialog *dlg) gtk_box_pack_start (GTK_BOX (vbox), dlg->priv->status, FALSE, FALSE, 0); -#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 (vbox), hbox, TRUE, TRUE, 0); table = gtk_table_new (2, 2, FALSE); @@ -339,11 +331,7 @@ file_transfer_dialog_init (FileTransferDialog *dlg) gtk_table_set_col_spacings (GTK_TABLE (table), 4); gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) progress_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - progress_vbox = gtk_vbox_new (TRUE, 0); -#endif gtk_box_pack_start (GTK_BOX (vbox), progress_vbox, FALSE, FALSE, 0); dlg->priv->progress = gtk_progress_bar_new (); @@ -406,9 +394,7 @@ file_transfer_job_progress (goffset current_bytes, data->current_bytes = current_bytes; data->total_bytes = total_bytes; - gdk_threads_enter (); file_transfer_job_update (data); - gdk_threads_leave (); } static void diff --git a/capplets/common/mate-theme-info.c b/capplets/common/mate-theme-info.c index 38f2c741..c80c95f1 100644 --- a/capplets/common/mate-theme-info.c +++ b/capplets/common/mate-theme-info.c @@ -1598,20 +1598,6 @@ gboolean mate_theme_meta_info_validate(const MateThemeMetaInfo* info, GError** e return FALSE; } -#if !GTK_CHECK_VERSION (3, 0, 0) - /* check for gtk theme engines */ - gchar *engine = gtk_theme_info_missing_engine(info->gtk_theme_name, TRUE); - - if (engine != NULL) - { - g_set_error (error, MATE_THEME_ERROR, MATE_THEME_ERROR_GTK_ENGINE_NOT_AVAILABLE, - _("This theme will not look as intended because the required GTK+ theme engine '%s' is not installed."), - engine); - g_free (engine); - return FALSE; - } -#endif - return TRUE; } @@ -1704,11 +1690,7 @@ mate_theme_info_register_theme_change (ThemeChangedCallback func, } gboolean -#if GTK_CHECK_VERSION (3, 0, 0) mate_theme_color_scheme_parse (const gchar *scheme, GdkRGBA *colors) -#else -mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors) -#endif { gchar **color_scheme_strings, **color_scheme_pair, *current_string; gint i; @@ -1735,7 +1717,6 @@ mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors) g_strstrip (color_scheme_pair[1]); if (!strcmp ("fg_color", color_scheme_pair[0])) -#if GTK_CHECK_VERSION (3, 0, 0) gdk_rgba_parse (&colors[COLOR_FG], color_scheme_pair[1]); else if (!strcmp ("bg_color", color_scheme_pair[0])) gdk_rgba_parse (&colors[COLOR_BG], color_scheme_pair[1]); @@ -1751,23 +1732,6 @@ mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors) gdk_rgba_parse (&colors[COLOR_TOOLTIP_FG], color_scheme_pair[1]); else if (!strcmp ("tooltip_bg_color", color_scheme_pair[0])) gdk_rgba_parse (&colors[COLOR_TOOLTIP_BG], color_scheme_pair[1]); -#else - gdk_color_parse (color_scheme_pair[1], &colors[COLOR_FG]); - else if (!strcmp ("bg_color", color_scheme_pair[0])) - gdk_color_parse (color_scheme_pair[1], &colors[COLOR_BG]); - else if (!strcmp ("text_color", color_scheme_pair[0])) - gdk_color_parse (color_scheme_pair[1], &colors[COLOR_TEXT]); - else if (!strcmp ("base_color", color_scheme_pair[0])) - gdk_color_parse (color_scheme_pair[1], &colors[COLOR_BASE]); - else if (!strcmp ("selected_fg_color", color_scheme_pair[0])) - gdk_color_parse (color_scheme_pair[1], &colors[COLOR_SELECTED_FG]); - else if (!strcmp ("selected_bg_color", color_scheme_pair[0])) - gdk_color_parse (color_scheme_pair[1], &colors[COLOR_SELECTED_BG]); - else if (!strcmp ("tooltip_fg_color", color_scheme_pair[0])) - gdk_color_parse (color_scheme_pair[1], &colors[COLOR_TOOLTIP_FG]); - else if (!strcmp ("tooltip_bg_color", color_scheme_pair[0])) - gdk_color_parse (color_scheme_pair[1], &colors[COLOR_TOOLTIP_BG]); -#endif } g_strfreev (color_scheme_pair); @@ -1781,11 +1745,7 @@ mate_theme_color_scheme_parse (const gchar *scheme, GdkColor *colors) gboolean mate_theme_color_scheme_equal (const gchar *s1, const gchar *s2) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA c1[NUM_SYMBOLIC_COLORS], c2[NUM_SYMBOLIC_COLORS]; -#else - GdkColor c1[NUM_SYMBOLIC_COLORS], c2[NUM_SYMBOLIC_COLORS]; -#endif int i; if (!mate_theme_color_scheme_parse (s1, c1) || @@ -1793,11 +1753,7 @@ mate_theme_color_scheme_equal (const gchar *s1, const gchar *s2) return FALSE; for (i = 0; i < NUM_SYMBOLIC_COLORS; ++i) { -#if GTK_CHECK_VERSION (3, 0, 0) if (!gdk_rgba_equal (&c1[i], &c2[i])) -#else - if (!gdk_color_equal (&c1[i], &c2[i])) -#endif return FALSE; } diff --git a/capplets/common/mate-theme-info.h b/capplets/common/mate-theme-info.h index 9b45951c..1ef14b37 100644 --- a/capplets/common/mate-theme-info.h +++ b/capplets/common/mate-theme-info.h @@ -183,13 +183,8 @@ void mate_theme_init (void); void mate_theme_info_register_theme_change (ThemeChangedCallback func, gpointer data); -#if GTK_CHECK_VERSION (3, 0, 0) gboolean mate_theme_color_scheme_parse (const gchar *scheme, GdkRGBA *colors); -#else -gboolean mate_theme_color_scheme_parse (const gchar *scheme, - GdkColor *colors); -#endif gboolean mate_theme_color_scheme_equal (const gchar *s1, const gchar *s2); diff --git a/capplets/common/theme-thumbnail.c b/capplets/common/theme-thumbnail.c index 775b460c..2b11d01f 100644 --- a/capplets/common/theme-thumbnail.c +++ b/capplets/common/theme-thumbnail.c @@ -19,14 +19,6 @@ #include "gtkrc-utils.h" #include "capplet-util.h" -#if !GTK_CHECK_VERSION (3, 0, 0) -#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y) -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) -#define GdkRegion cairo_region_t -#define gdk_region_destroy cairo_region_destroy -#endif typedef struct { gboolean set; @@ -97,48 +89,8 @@ static int pipe_from_factory_fd[2]; #define MARCO_THUMBNAIL_WIDTH 120 #define MARCO_THUMBNAIL_HEIGHT 60 -/* This draw the thumbnail of gtk - */ -#if !GTK_CHECK_VERSION (3, 0, 0) -static GdkPixmap * -draw_window_on_pixbuf(GtkWidget* widget) -{ - GdkVisual* visual; - GdkPixmap* pixmap; - GtkStyle* style; - GdkScreen* screen = gdk_screen_get_default(); - GdkWindow* window; - gint width, height; - - gtk_widget_ensure_style(widget); - - style = gtk_widget_get_style(widget); - - g_assert(style); - g_assert(style->font_desc); - - gtk_window_get_size(GTK_WINDOW(widget), &width, &height); - - visual = gtk_widget_get_visual(widget); - pixmap = gdk_pixmap_new(NULL, width, height, gdk_visual_get_depth (visual)); - gdk_drawable_set_colormap(GDK_DRAWABLE(pixmap), gtk_widget_get_colormap(widget)); - - window = gtk_widget_get_window(widget); - gdk_window_redirect_to_drawable(window, pixmap, 0, 0, 0, 0, width, height); - gdk_window_set_override_redirect(window, TRUE); - gtk_window_move(GTK_WINDOW(widget), gdk_screen_get_width(screen), gdk_screen_get_height(screen)); - gtk_widget_show(widget); - - gdk_window_process_updates(window, TRUE); - - gtk_widget_hide(widget); - - return pixmap; -} -#endif - -static void pixbuf_apply_mask_region(GdkPixbuf* pixbuf, GdkRegion* region) +static void pixbuf_apply_mask_region(GdkPixbuf* pixbuf, cairo_region_t* region) { gint nchannels, rowstride, w, h; guchar *pixels, *p; @@ -158,11 +110,7 @@ static void pixbuf_apply_mask_region(GdkPixbuf* pixbuf, GdkRegion* region) for (w = 0; w < gdk_pixbuf_get_width (pixbuf); ++w) for (h = 0; h < gdk_pixbuf_get_height (pixbuf); ++h) { -#if GTK_CHECK_VERSION (3, 0, 0) if (!cairo_region_contains_point (region, w, h)) -#else - if (!gdk_region_point_in (region, w, h)) -#endif { p = pixels + h * rowstride + w * nchannels; if (G_BYTE_ORDER == G_BIG_ENDIAN) @@ -201,11 +149,7 @@ create_folder_icon (char *icon_theme_name) if (folder_icon_info != NULL) { folder_icon = gtk_icon_info_load_icon (folder_icon_info, NULL); -#if GTK_CHECK_VERSION (3, 8, 0) g_object_unref (folder_icon_info); -#else - gtk_icon_info_free (folder_icon_info); -#endif } if (folder_icon == NULL) @@ -236,14 +180,11 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) GtkRequisition requisition; GtkAllocation allocation; GtkAllocation vbox_allocation; -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkPixmap *pixmap; -#endif MetaFrameFlags flags; MetaTheme *theme; GdkPixbuf *pixbuf, *icon; int icon_width, icon_height; - GdkRegion *region; + cairo_region_t *region; g_object_set (gtk_settings_get_default (), "gtk-theme-name", (char *) theme_thumbnail_data->control_theme_name->data, @@ -272,36 +213,19 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) META_FRAME_ALLOWS_SHADE | META_FRAME_ALLOWS_MOVE; -#if GTK_CHECK_VERSION (3, 0, 0) window = gtk_offscreen_window_new (); -#else - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); -#endif preview = meta_preview_new (); gtk_container_add (GTK_CONTAINER (window), preview); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_show_all (window); -#else - gtk_widget_realize (window); - gtk_widget_realize (preview); -#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_container_set_border_width (GTK_CONTAINER (vbox), 6); gtk_container_add (GTK_CONTAINER (preview), vbox); align = gtk_alignment_new (0, 0, 0.0, 0.0); gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0); stock_button = gtk_button_new_from_stock (GTK_STOCK_OPEN); gtk_container_add (GTK_CONTAINER (align), stock_button); -#if GTK_CHECK_VERSION (3, 0, 0) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - box = gtk_hbox_new (FALSE, 0); -#endif gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0); checkbox = gtk_check_button_new (); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE); @@ -325,18 +249,11 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) gtk_widget_size_allocate (window, &allocation); gtk_widget_get_preferred_size (window, &requisition, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_queue_draw (window); while (gtk_events_pending ()) gtk_main_iteration (); pixbuf = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (window)); -#else - pixmap = draw_window_on_pixbuf (window); - - pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE); - gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE); -#endif gtk_widget_get_allocation (vbox, &vbox_allocation); @@ -351,14 +268,11 @@ create_meta_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) region = meta_preview_get_clip_region (META_PREVIEW (preview), META_THUMBNAIL_SIZE, META_THUMBNAIL_SIZE); pixbuf_apply_mask_region (pixbuf, region); - gdk_region_destroy (region); + cairo_region_destroy (region); g_object_unref (icon); gtk_widget_destroy (window); meta_theme_free (theme); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_object_unref (pixmap); -#endif return pixbuf; } @@ -370,9 +284,6 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) GtkWidget *window, *vbox, *box, *stock_button, *checkbox, *radio; GtkRequisition requisition; GtkAllocation allocation; -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkPixmap *pixmap; -#endif GdkPixbuf *pixbuf, *retval; gint width, height; @@ -381,23 +292,11 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) "gtk-color-scheme", (char *) theme_thumbnail_data->gtk_color_scheme->data, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) window = gtk_offscreen_window_new (); -#else - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); -#endif -#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 (window), vbox); -#if GTK_CHECK_VERSION (3, 0, 0) box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - box = gtk_hbox_new (FALSE, 6); -#endif gtk_container_set_border_width (GTK_CONTAINER (box), 6); gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0); stock_button = gtk_button_new_from_stock (GTK_STOCK_OPEN); @@ -408,9 +307,7 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) radio = gtk_radio_button_new_from_widget (NULL); gtk_box_pack_start (GTK_BOX (box), radio, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_show_all (window); -#else gtk_widget_show_all (vbox); gtk_widget_realize (stock_button); gtk_widget_realize (gtk_bin_get_child (GTK_BIN (stock_button))); @@ -420,7 +317,6 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) gtk_widget_map (gtk_bin_get_child (GTK_BIN (stock_button))); gtk_widget_map (checkbox); gtk_widget_map (radio); -#endif gtk_widget_get_preferred_size (window, &requisition, NULL); allocation.x = 0; @@ -432,18 +328,11 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) gtk_window_get_size (GTK_WINDOW (window), &width, &height); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_queue_draw (window); while (gtk_events_pending ()) gtk_main_iteration (); pixbuf = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (window)); -#else - pixmap = draw_window_on_pixbuf (window); - - pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height); - gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, width, height); -#endif retval = gdk_pixbuf_scale_simple (pixbuf, GTK_THUMBNAIL_SIZE, @@ -451,9 +340,6 @@ create_gtk_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) GDK_INTERP_BILINEAR); g_object_unref (pixbuf); gtk_widget_destroy (window); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_object_unref (pixmap); -#endif return retval; } @@ -466,11 +352,8 @@ create_marco_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) MetaTheme *theme; GtkRequisition requisition; GtkAllocation allocation; -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkPixmap *pixmap; -#endif GdkPixbuf *pixbuf, *retval; - GdkRegion *region; + cairo_region_t *region; theme = meta_theme_load ((char *) theme_thumbnail_data->wm_theme_name->data, NULL); if (theme == NULL) @@ -486,11 +369,7 @@ create_marco_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) META_FRAME_ALLOWS_SHADE | META_FRAME_ALLOWS_MOVE; -#if GTK_CHECK_VERSION (3, 0, 0) window = gtk_offscreen_window_new (); -#else - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); -#endif gtk_window_set_default_size (GTK_WINDOW (window), (int) MARCO_THUMBNAIL_WIDTH * 1.2, (int) MARCO_THUMBNAIL_HEIGHT * 1.2); preview = meta_preview_new (); @@ -502,15 +381,7 @@ create_marco_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) dummy = gtk_label_new (""); gtk_container_add (GTK_CONTAINER (preview), dummy); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_show_all (window); -#else - gtk_widget_realize (window); - gtk_widget_realize (preview); - gtk_widget_realize (dummy); - gtk_widget_show_all (preview); - gtk_widget_map (dummy); -#endif gtk_widget_get_preferred_size (window, &requisition, NULL); allocation.x = 0; @@ -520,23 +391,16 @@ create_marco_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) gtk_widget_size_allocate (window, &allocation); gtk_widget_get_preferred_size (window, &requisition, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_queue_draw (window); while (gtk_events_pending ()) gtk_main_iteration (); pixbuf = gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (window)); -#else - pixmap = draw_window_on_pixbuf (window); - - pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, (int) MARCO_THUMBNAIL_WIDTH * 1.2, (int) MARCO_THUMBNAIL_HEIGHT * 1.2); - gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, (int) MARCO_THUMBNAIL_WIDTH * 1.2, (int) MARCO_THUMBNAIL_HEIGHT * 1.2); -#endif region = meta_preview_get_clip_region (META_PREVIEW (preview), MARCO_THUMBNAIL_WIDTH * 1.2, MARCO_THUMBNAIL_HEIGHT * 1.2); pixbuf_apply_mask_region (pixbuf, region); - gdk_region_destroy (region); + cairo_region_destroy (region); retval = gdk_pixbuf_scale_simple (pixbuf, @@ -547,9 +411,6 @@ create_marco_theme_pixbuf (ThemeThumbnailData *theme_thumbnail_data) gtk_widget_destroy (window); meta_theme_free (theme); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_object_unref (pixmap); -#endif return retval; } |