From 0db54b288c7eca478a13c33ccd3b202d6e3688f9 Mon Sep 17 00:00:00 2001 From: infirit Date: Thu, 3 Jul 2014 13:35:27 +0200 Subject: Use gtk_widget_get_visible for both Gtk+ versions Also fix a bug in add_notification_action in coco-theme --- src/themes/coco/coco-theme.c | 6 +----- src/themes/nodoka/nodoka-theme.c | 12 ++++-------- src/themes/slider/theme.c | 8 ++------ src/themes/standard/theme.c | 8 ++------ 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c index 2825500..d4747f2 100644 --- a/src/themes/coco/coco-theme.c +++ b/src/themes/coco/coco-theme.c @@ -585,11 +585,7 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, g_assert(windata != NULL); -#if GTK_CHECK_VERSION(3, 0, 0) - if (gtk_widget_get_visible(windata->actions_box)) -#else - if (!GTK_WIDGET_VISIBLE(windata->actions_box)) -#endif + if (!gtk_widget_get_visible(windata->actions_box)) { GtkWidget *alignment; diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c index 2a0e56a..64f8811 100644 --- a/src/themes/nodoka/nodoka-theme.c +++ b/src/themes/nodoka/nodoka-theme.c @@ -27,10 +27,6 @@ #include -#if GTK_CHECK_VERSION(3, 0, 0) - #define GTK_WIDGET_VISIBLE(w) gtk_widget_get_visible(w) -#endif - /* Define basic nodoka types */ typedef void (*ActionInvokedCb)(GtkWindow *nw, const char *key); typedef void (*UrlClickedCb)(GtkWindow *nw, const char *url); @@ -315,9 +311,9 @@ update_content_hbox_visibility(WindowData *windata) * This is all a hack, but until we have a libview-style ContentBox, * it'll just have to do. */ - if (GTK_WIDGET_VISIBLE(windata->icon) || - GTK_WIDGET_VISIBLE(windata->body_label) || - GTK_WIDGET_VISIBLE(windata->actions_box)) + if (gtk_widget_get_visible(windata->icon) || + gtk_widget_get_visible(windata->body_label) || + gtk_widget_get_visible(windata->actions_box)) { gtk_widget_show(windata->content_hbox); } @@ -1040,7 +1036,7 @@ add_notification_action(GtkWindow *nw, const char *text, const char *key, g_assert(windata != NULL); - if (!GTK_WIDGET_VISIBLE(windata->actions_box)) + if (!gtk_widget_get_visible(windata->actions_box)) { GtkWidget *alignment; diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c index d116f05..c254739 100644 --- a/src/themes/slider/theme.c +++ b/src/themes/slider/theme.c @@ -77,10 +77,6 @@ enum { #define MAX_ICON_SIZE IMAGE_SIZE -#if GTK_CHECK_VERSION(3, 0, 0) -#define GTK_WIDGET_VISIBLE(w) gtk_widget_get_visible(w) -#endif - static void draw_round_rect(cairo_t* cr, gdouble aspect, gdouble x, gdouble y, gdouble corner_radius, gdouble width, gdouble height) { gdouble radius = corner_radius / aspect; @@ -340,7 +336,7 @@ static void destroy_windata(WindowData* windata) static void update_content_hbox_visibility(WindowData* windata) { - if (GTK_WIDGET_VISIBLE(windata->icon) || GTK_WIDGET_VISIBLE(windata->body_label) || GTK_WIDGET_VISIBLE(windata->actions_box)) + if (gtk_widget_get_visible(windata->icon) || gtk_widget_get_visible(windata->body_label) || gtk_widget_get_visible(windata->actions_box)) { gtk_widget_show(windata->content_hbox); } @@ -1006,7 +1002,7 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A g_assert(windata != NULL); - if (!GTK_WIDGET_VISIBLE(windata->actions_box)) + if (!gtk_widget_get_visible(windata->actions_box)) { GtkWidget* alignment; diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c index f7cee91..022a6cc 100644 --- a/src/themes/standard/theme.c +++ b/src/themes/standard/theme.c @@ -23,10 +23,6 @@ #include -#if GTK_CHECK_VERSION(3, 0, 0) -#define GTK_WIDGET_VISIBLE(w) gtk_widget_get_visible(w) -#endif - typedef void (*ActionInvokedCb) (GtkWindow* nw, const char* key); typedef void (*UrlClickedCb) (GtkWindow* nw, const char* url); @@ -626,7 +622,7 @@ static void update_content_hbox_visibility(WindowData* windata) * This is all a hack, but until we have a libview-style ContentBox, * it'll just have to do. */ - if (GTK_WIDGET_VISIBLE(windata->icon) || GTK_WIDGET_VISIBLE(windata->body_label) || GTK_WIDGET_VISIBLE(windata->actions_box)) + if (gtk_widget_get_visible(windata->icon) || gtk_widget_get_visible(windata->body_label) || gtk_widget_get_visible(windata->actions_box)) { gtk_widget_show(windata->content_hbox); } @@ -1046,7 +1042,7 @@ void add_notification_action(GtkWindow* nw, const char* text, const char* key, A g_assert(windata != NULL); - if (!GTK_WIDGET_VISIBLE(windata->actions_box)) + if (!gtk_widget_get_visible(windata->actions_box)) { GtkWidget* alignment; -- cgit v1.2.1