diff options
author | zhuyaliang <[email protected]> | 2023-10-24 11:11:41 +0800 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-10-28 13:57:19 +0200 |
commit | 23fc7b675ebac7a9b02257a31203974d72f584b1 (patch) | |
tree | 9d39d58e26592a40c1a942e6f9b9af36a78db574 | |
parent | b1331ef7978fdaa11049d9958e4ed279103af570 (diff) | |
download | mate-control-center-23fc7b675ebac7a9b02257a31203974d72f584b1.tar.bz2 mate-control-center-23fc7b675ebac7a9b02257a31203974d72f584b1.tar.xz |
appearance: Fix compilation warnings replace deprecated functions
g_pattern_match_string has been deprecated since GLib 2.70
-rw-r--r-- | capplets/appearance/appearance-desktop.c | 29 | ||||
-rw-r--r-- | capplets/appearance/theme-installer.c | 45 |
2 files changed, 39 insertions, 35 deletions
diff --git a/capplets/appearance/appearance-desktop.c b/capplets/appearance/appearance-desktop.c index d9381818..2c05694c 100644 --- a/capplets/appearance/appearance-desktop.c +++ b/capplets/appearance/appearance-desktop.c @@ -1042,26 +1042,21 @@ static GdkPixbuf *buttons[3]; static void create_button_images (AppearanceData *data) { - GtkWidget *widget = (GtkWidget*)data->wp_view; - GtkStyle *style = gtk_widget_get_style (widget); - GtkIconSet *icon_set; - GdkPixbuf *pixbuf, *pb, *pb2; - gint i, w, h; - - icon_set = gtk_style_lookup_icon_set (style, "gtk-media-play"); - pb = gtk_icon_set_render_icon (icon_set, - style, - GTK_TEXT_DIR_RTL, - GTK_STATE_NORMAL, + GtkIconTheme *theme; + GdkPixbuf *pixbuf, *pb, *pb2; + gint i, w, h; + + theme = gtk_icon_theme_get_default (); + pb = gtk_icon_theme_load_icon (theme, + "media-playback-start", GTK_ICON_SIZE_MENU, - widget, + GTK_ICON_LOOKUP_DIR_RTL, NULL); - pb2 = gtk_icon_set_render_icon (icon_set, - style, - GTK_TEXT_DIR_LTR, - GTK_STATE_NORMAL, + + pb2 = gtk_icon_theme_load_icon (theme, + "media-playback-start", GTK_ICON_SIZE_MENU, - widget, + GTK_ICON_LOOKUP_DIR_LTR, NULL); w = gdk_pixbuf_get_width (pb); h = gdk_pixbuf_get_height (pb); diff --git a/capplets/appearance/theme-installer.c b/capplets/appearance/theme-installer.c index 22226397..68ce08ca 100644 --- a/capplets/appearance/theme-installer.c +++ b/capplets/appearance/theme-installer.c @@ -34,6 +34,10 @@ #include "theme-installer.h" #include "theme-util.h" +#if !GLIB_CHECK_VERSION(2,70,0) +#define g_pattern_spec_match_string g_pattern_match_string +#endif + enum { THEME_INVALID, THEME_ICON, @@ -52,18 +56,18 @@ enum { DIRECTORY }; -static gboolean -cleanup_tmp_dir (GIOSchedulerJob *job, - GCancellable *cancellable, - const gchar *tmp_dir) +static void +cleanup_tmp_dir (GTask *task G_GNUC_UNUSED, + gpointer source_object G_GNUC_UNUSED, + gpointer task_data, + GCancellable *cancellable G_GNUC_UNUSED) { GFile *directory; + char *tmp_dir = task_data; directory = g_file_new_for_path (tmp_dir); capplet_file_delete_recursive (directory, NULL); g_object_unref (directory); - - return FALSE; } static int @@ -88,12 +92,12 @@ file_theme_type (const gchar *dir) g_free (filename); pattern = g_pattern_spec_new ("*[Icon Theme]*"); - match = g_pattern_match_string (pattern, file_contents); + match = g_pattern_spec_match_string (pattern, file_contents); g_pattern_spec_free (pattern); if (match) { pattern = g_pattern_spec_new ("*Directories=*"); - match = g_pattern_match_string (pattern, file_contents); + match = g_pattern_spec_match_string (pattern, file_contents); g_pattern_spec_free (pattern); g_free (file_contents); @@ -112,7 +116,7 @@ file_theme_type (const gchar *dir) } pattern = g_pattern_spec_new ("*[X-GNOME-Metatheme]*"); - match = g_pattern_match_string (pattern, file_contents); + match = g_pattern_spec_match_string (pattern, file_contents); g_pattern_spec_free (pattern); g_free (file_contents); @@ -548,6 +552,18 @@ end: } static void +theme_cleanup_tmp_dir (char *tmp_dir) +{ + GTask *task; + + task = g_task_new (NULL, NULL, NULL, NULL); + g_task_set_task_data (task, tmp_dir, g_free); + g_task_run_in_thread (task, cleanup_tmp_dir); + + g_object_unref (task); +} + +static void process_local_theme (GtkWindow *parent, const char *path) { @@ -606,12 +622,7 @@ process_local_theme (GtkWindow *parent, if (!process_local_theme_archive (parent, filetype, tmp_dir, path) || ((dir = g_dir_open (tmp_dir, 0, NULL)) == NULL)) { - g_io_scheduler_push_job ((GIOSchedulerJobFunc) cleanup_tmp_dir, - g_strdup (tmp_dir), - g_free, - G_PRIORITY_DEFAULT, - NULL); - g_free (tmp_dir); + theme_cleanup_tmp_dir (tmp_dir); return; } @@ -663,9 +674,7 @@ process_local_theme (GtkWindow *parent, gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } - g_io_scheduler_push_job ((GIOSchedulerJobFunc) cleanup_tmp_dir, - tmp_dir, g_free, - G_PRIORITY_DEFAULT, NULL); + theme_cleanup_tmp_dir (tmp_dir); } } |