summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-10-16 22:51:15 +0200
committerraveit65 <[email protected]>2020-11-24 14:53:30 +0100
commite6805e149177a343f3152bcd2cea9165904b686c (patch)
tree9597206276748da71ed021f45918110b9db191bb
parentb45a719071cdb7bf009f7173b04a553b546491a5 (diff)
downloadmate-control-center-e6805e149177a343f3152bcd2cea9165904b686c.tar.bz2
mate-control-center-e6805e149177a343f3152bcd2cea9165904b686c.tar.xz
appearance: Introduce GET_WINDOW macro
-rw-r--r--capplets/appearance/appearance-desktop.c2
-rw-r--r--capplets/appearance/appearance-font.c4
-rw-r--r--capplets/appearance/appearance-main.c2
-rw-r--r--capplets/appearance/appearance-themes.c11
-rw-r--r--capplets/appearance/appearance.h1
-rw-r--r--capplets/appearance/theme-save.c2
6 files changed, 10 insertions, 12 deletions
diff --git a/capplets/appearance/appearance-desktop.c b/capplets/appearance/appearance-desktop.c
index 397527bf..91d57964 100644
--- a/capplets/appearance/appearance-desktop.c
+++ b/capplets/appearance/appearance-desktop.c
@@ -613,7 +613,7 @@ wp_create_filechooser (AppearanceData *data)
data->wp_filesel = GTK_FILE_CHOOSER (
gtk_file_chooser_dialog_new (_("Add Wallpaper"),
- GTK_WINDOW (appearance_capplet_get_widget (data, "appearance_window")),
+ GET_WINDOW ("appearance_window"),
GTK_FILE_CHOOSER_ACTION_OPEN,
"gtk-cancel",
GTK_RESPONSE_CANCEL,
diff --git a/capplets/appearance/appearance-font.c b/capplets/appearance/appearance-font.c
index 528253fa..9f1bdba5 100644
--- a/capplets/appearance/appearance-font.c
+++ b/capplets/appearance/appearance-font.c
@@ -610,7 +610,7 @@ cb_add_new_font (GtkWidget *button,
gint res;
dialog = gtk_file_chooser_dialog_new (_("Select Font"),
- GTK_WINDOW (appearance_capplet_get_widget (data, "appearance_window")),
+ GET_WINDOW ("appearance_window"),
action,
_("_Cancel"),
GTK_RESPONSE_CANCEL,
@@ -648,7 +648,7 @@ cb_show_details (GtkWidget *button,
data->font_details = appearance_capplet_get_widget (data, "render_details");
gtk_window_set_transient_for (GTK_WINDOW (data->font_details),
- GTK_WINDOW (appearance_capplet_get_widget (data, "appearance_window")));
+ GET_WINDOW ("appearance_window"));
spinner = appearance_capplet_get_widget (data, "dpi_spinner");
toggle = appearance_capplet_get_widget (data, "dpi_reset_switch");
diff --git a/capplets/appearance/appearance-main.c b/capplets/appearance/appearance-main.c
index 4574aaed..7815e885 100644
--- a/capplets/appearance/appearance-main.c
+++ b/capplets/appearance/appearance-main.c
@@ -193,7 +193,7 @@ main (int argc, char **argv)
/* prepare the main window */
w = appearance_capplet_get_widget (data, "appearance_window");
- context = gtk_widget_get_style_context (GTK_WIDGET (w));
+ context = gtk_widget_get_style_context (w);
gtk_style_context_add_class (context, "appearance-window");
capplet_set_icon (w, "preferences-desktop-theme");
diff --git a/capplets/appearance/appearance-themes.c b/capplets/appearance/appearance-themes.c
index a1cfdd62..de164344 100644
--- a/capplets/appearance/appearance-themes.c
+++ b/capplets/appearance/appearance-themes.c
@@ -784,11 +784,10 @@ theme_selection_changed_cb (GtkWidget *icon_view, AppearanceData *data)
static void
theme_custom_cb (GtkWidget *button, AppearanceData *data)
{
- GtkWidget *w, *parent;
+ GtkWidget *w;
w = appearance_capplet_get_widget (data, "theme_details");
- parent = appearance_capplet_get_widget (data, "appearance_window");
- gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (parent));
+ gtk_window_set_transient_for (GTK_WINDOW (w), GET_WINDOW ("appearance_window"));
gtk_widget_show_all (w);
}
@@ -801,8 +800,7 @@ theme_save_cb (GtkWidget *button, AppearanceData *data)
static void
theme_install_cb (GtkWidget *button, AppearanceData *data)
{
- mate_theme_installer_run (
- GTK_WINDOW (appearance_capplet_get_widget (data, "appearance_window")));
+ mate_theme_installer_run (GET_WINDOW ("appearance_window"));
}
static void
@@ -963,8 +961,7 @@ theme_drag_data_received_cb (GtkWidget *widget,
if (uris != NULL && uris[0] != NULL) {
GFile *f = g_file_new_for_uri (uris[0]);
- mate_theme_install (f,
- GTK_WINDOW (appearance_capplet_get_widget (data, "appearance_window")));
+ mate_theme_install (f, GET_WINDOW ("appearance_window"));
g_object_unref (f);
}
diff --git a/capplets/appearance/appearance.h b/capplets/appearance/appearance.h
index 307b3033..0e301a96 100644
--- a/capplets/appearance/appearance.h
+++ b/capplets/appearance/appearance.h
@@ -137,3 +137,4 @@ typedef struct {
} AppearanceData;
#define appearance_capplet_get_widget(x, y) (GtkWidget*) gtk_builder_get_object(x->ui, y)
+#define GET_WINDOW(x) (GTK_WINDOW (gtk_builder_get_object (data->ui, (x))))
diff --git a/capplets/appearance/theme-save.c b/capplets/appearance/theme-save.c
index cbfccdb3..380e9312 100644
--- a/capplets/appearance/theme-save.c
+++ b/capplets/appearance/theme-save.c
@@ -378,6 +378,6 @@ theme_save_dialog_run (MateThemeMetaInfo *theme_info,
gtk_text_buffer_set_text (text_buffer, "", 0);
g_object_set_data (G_OBJECT (data->theme_save_dialog), "meta-theme-info", theme_info);
gtk_window_set_transient_for (GTK_WINDOW (data->theme_save_dialog),
- GTK_WINDOW (appearance_capplet_get_widget (data, "appearance_window")));
+ GET_WINDOW ("appearance_window"));
gtk_widget_show (data->theme_save_dialog);
}