From abec93de17fb483764ab27c5c781204cef561261 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Mon, 30 May 2016 22:52:08 +0200 Subject: GTK+3 sidebars and caja-places: port style_set to style_updated --- src/caja-history-sidebar.c | 11 +++++++---- src/caja-information-panel.c | 7 +++---- src/caja-pathbar.c | 26 +++++++++++++++++--------- src/caja-places-sidebar.c | 13 ++++++++----- src/caja-sidebar-title.c | 14 ++++++++++---- 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/caja-history-sidebar.c b/src/caja-history-sidebar.c index 062d943d..4ad18137 100644 --- a/src/caja-history-sidebar.c +++ b/src/caja-history-sidebar.c @@ -75,8 +75,7 @@ static void caja_history_sidebar_iface_init (CajaSidebarIface *i static void sidebar_provider_iface_init (CajaSidebarProviderIface *iface); static GType caja_history_sidebar_provider_get_type (void); #if GTK_CHECK_VERSION (3, 0, 0) -static void caja_history_sidebar_style_set (GtkWidget *widget, - GtkStyleContext *previous_style); +static void caja_history_sidebar_style_updated (GtkWidget *widget); #else static void caja_history_sidebar_style_set (GtkWidget *widget, GtkStyle *previous_style); @@ -326,7 +325,11 @@ caja_history_sidebar_class_init (CajaHistorySidebarClass *class) { G_OBJECT_CLASS (class)->finalize = caja_history_sidebar_finalize; +#if GTK_CHECK_VERSION (3, 0, 0) + GTK_WIDGET_CLASS (class)->style_updated = caja_history_sidebar_style_updated; +#else GTK_WIDGET_CLASS (class)->style_set = caja_history_sidebar_style_set; +#endif } static const char * @@ -379,10 +382,10 @@ caja_history_sidebar_set_parent_window (CajaHistorySidebar *sidebar, } static void -caja_history_sidebar_style_set (GtkWidget *widget, #if GTK_CHECK_VERSION (3, 0, 0) - GtkStyleContext *previous_style) +caja_history_sidebar_style_updated (GtkWidget *widget) #else +caja_history_sidebar_style_set (GtkWidget *widget, GtkStyle *previous_style) #endif { diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c index c90e6b76..ec4e6964 100644 --- a/src/caja-information-panel.c +++ b/src/caja-information-panel.c @@ -82,8 +82,7 @@ static void caja_information_panel_drag_data_received (GtkWidget guint time); static void caja_information_panel_read_defaults (CajaInformationPanel *information_panel); #if GTK_CHECK_VERSION (3, 0, 0) -static void caja_information_panel_style_set (GtkWidget *widget, - GtkStyleContext *previous_style); +static void caja_information_panel_style_updated (GtkWidget *widget); #else static void caja_information_panel_style_set (GtkWidget *widget, GtkStyle *previous_style); @@ -211,7 +210,7 @@ caja_information_panel_class_init (CajaInformationPanelClass *klass) widget_class->drag_data_received = caja_information_panel_drag_data_received; widget_class->button_press_event = caja_information_panel_press_event; - widget_class->style_set = caja_information_panel_style_set; + widget_class->style_updated = caja_information_panel_style_updated; /* add the "location changed" signal */ signals[LOCATION_CHANGED] = g_signal_new @@ -1180,7 +1179,7 @@ title_changed_callback (CajaWindowInfo *window, /* ::style_set handler for the information_panel */ static void #if GTK_CHECK_VERSION (3, 0, 0) -caja_information_panel_style_set (GtkWidget *widget, GtkStyleContext *previous_style) +caja_information_panel_style_updated (GtkWidget *widget) #else caja_information_panel_style_set (GtkWidget *widget, GtkStyle *previous_style) #endif diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c index ded4595d..82d4e31d 100644 --- a/src/caja-pathbar.c +++ b/src/caja-pathbar.c @@ -140,8 +140,10 @@ static void caja_path_bar_grab_notify (GtkWidget *widget, gboolean was_grabbed); static void caja_path_bar_state_changed (GtkWidget *widget, GtkStateType previous_state); -#if !GTK_CHECK_VERSION (3, 0, 0) -static void caja_path_bar_style_set (GtkWidget *widget, +#if GTK_CHECK_VERSION (3, 0, 0) +static void caja_path_bar_style_updated (GtkWidget *widget); +#else +static void caja_path_bar_style_set (GtkWidget *widget), GtkStyle *previous_style); #endif static void caja_path_bar_screen_changed (GtkWidget *widget, @@ -403,7 +405,9 @@ caja_path_bar_class_init (CajaPathBarClass *path_bar_class) #endif widget_class->unmap = caja_path_bar_unmap; widget_class->size_allocate = caja_path_bar_size_allocate; -#if !GTK_CHECK_VERSION (3, 0, 0) +#if GTK_CHECK_VERSION (3, 0, 0) + widget_class->style_updated = caja_path_bar_style_updated; +#else widget_class->style_set = caja_path_bar_style_set; #endif widget_class->screen_changed = caja_path_bar_screen_changed; @@ -960,18 +964,24 @@ caja_path_bar_size_allocate (GtkWidget *widget, } } -#if !GTK_CHECK_VERSION (3, 0, 0) static void +#if GTK_CHECK_VERSION (3, 0, 0) +caja_path_bar_style_updated (GtkWidget *widget) +{ + if (GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_updated) + { + GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_updated (widget); +#else caja_path_bar_style_set (GtkWidget *widget, GtkStyle *previous_style) { if (GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_set) { GTK_WIDGET_CLASS (caja_path_bar_parent_class)->style_set (widget, previous_style); +#endif } caja_path_bar_check_icon_theme (CAJA_PATH_BAR (widget)); } -#endif static void caja_path_bar_screen_changed (GtkWidget *widget, @@ -986,9 +996,7 @@ caja_path_bar_screen_changed (GtkWidget *widget, { remove_settings_signal (CAJA_PATH_BAR (widget), previous_screen); } -#if !GTK_CHECK_VERSION (3, 0, 0) caja_path_bar_check_icon_theme (CAJA_PATH_BAR (widget)); -#endif } static gboolean @@ -1389,7 +1397,7 @@ settings_notify_cb (GObject *object, change_icon_theme (path_bar); } } -#if !GTK_CHECK_VERSION (3, 0, 0) + static void caja_path_bar_check_icon_theme (CajaPathBar *path_bar) { @@ -1405,7 +1413,7 @@ caja_path_bar_check_icon_theme (CajaPathBar *path_bar) change_icon_theme (path_bar); } -#endif + /* Public functions and their helpers */ void caja_path_bar_clear_buttons (CajaPathBar *path_bar) diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c index d4af834f..fea0a913 100644 --- a/src/caja-places-sidebar.c +++ b/src/caja-places-sidebar.c @@ -167,10 +167,9 @@ static void open_selected_bookmark (CajaPlacesSidebar CajaWindowOpenFlags flags); #if GTK_CHECK_VERSION (3, 0, 0) -static void caja_places_sidebar_style_set (GtkWidget *widget, - GtkStyleContext *previous_style); +static void caja_places_sidebar_style_updated (GtkWidget *widget); #else -static void caja_places_sidebar_style_set (GtkWidget *widget, +static void caja_places_sidebar_style_set (GtkWidget *widget, GtkStyle *previous_style); #endif static gboolean eject_or_unmount_bookmark (CajaPlacesSidebar *sidebar, @@ -3394,7 +3393,11 @@ caja_places_sidebar_class_init (CajaPlacesSidebarClass *class) { G_OBJECT_CLASS (class)->dispose = caja_places_sidebar_dispose; +#if GTK_CHECK_VERSION (3, 0, 0) + GTK_WIDGET_CLASS (class)->style_updated = caja_places_sidebar_style_updated; +#else GTK_WIDGET_CLASS (class)->style_set = caja_places_sidebar_style_set; +#endif } static const char * @@ -3482,10 +3485,10 @@ caja_places_sidebar_set_parent_window (CajaPlacesSidebar *sidebar, } static void -caja_places_sidebar_style_set (GtkWidget *widget, #if GTK_CHECK_VERSION (3, 0, 0) - GtkStyleContext *previous_style) +caja_places_sidebar_style_updated (GtkWidget *widget) #else +caja_places_sidebar_style_set (GtkWidget *widget, GtkStyle *previous_style) #endif { diff --git a/src/caja-sidebar-title.c b/src/caja-sidebar-title.c index 35d12d36..623dc1e2 100644 --- a/src/caja-sidebar-title.c +++ b/src/caja-sidebar-title.c @@ -75,8 +75,7 @@ static void update_all (CajaSidebarTitle *sidebar_title); static void update_more_info (CajaSidebarTitle *sidebar_title); static void update_title_font (CajaSidebarTitle *sidebar_title); #if GTK_CHECK_VERSION (3, 0, 0) -static void style_set (GtkWidget *widget, - GtkStyleContext *previous_style); +static void style_updated (GtkWidget *widget); #else static void style_set (GtkWidget *widget, GtkStyle *previous_style); @@ -124,8 +123,7 @@ G_DEFINE_TYPE (CajaSidebarTitle, caja_sidebar_title, GTK_TYPE_VBOX) #if GTK_CHECK_VERSION (3, 0, 0) static void -style_set (GtkWidget *widget, - GtkStyleContext *previous_style) +style_updated (GtkWidget *widget) { CajaSidebarTitle *sidebar_title; #else @@ -196,7 +194,11 @@ caja_sidebar_title_init (CajaSidebarTitle *sidebar_title) update_all (sidebar_title); /* initialize the label colors & fonts */ +#if GTK_CHECK_VERSION (3, 0, 0) + style_updated (GTK_WIDGET (sidebar_title)); +#else style_set (GTK_WIDGET (sidebar_title), NULL); +#endif g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS, @@ -252,7 +254,11 @@ caja_sidebar_title_class_init (CajaSidebarTitleClass *klass) widget_class = GTK_WIDGET_CLASS (klass); widget_class->size_allocate = caja_sidebar_title_size_allocate; +#if GTK_CHECK_VERSION (3, 0, 0) + widget_class->style_updated = style_updated; +#else widget_class->style_set = style_set; +#endif gtk_widget_class_install_style_property (widget_class, #if GTK_CHECK_VERSION (3, 0, 0) -- cgit v1.2.1