From 079254bb48c28f62d15270028e64308347888a76 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Thu, 4 Nov 2010 17:12:52 -0200 Subject: Add libnotify as optional in zenity instalation --- src/main.c | 2 ++ src/notification.c | 2 ++ src/option.c | 15 ++++++++++++++- src/option.h | 4 ++++ src/zenity.h | 5 +++++ 5 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index ee8fc3bf..05176158 100644 --- a/src/main.c +++ b/src/main.c @@ -75,9 +75,11 @@ main (gint argc, gchar **argv) { results->tree_data->data = (const gchar **) argv + 1; zenity_tree (results->data, results->tree_data); break; +#ifdef HAVE_LIBNOTIFY case MODE_NOTIFICATION: zenity_notification (results->data, results->notification_data); break; +#endif case MODE_PROGRESS: zenity_progress (results->data, results->progress_data); break; diff --git a/src/notification.c b/src/notification.c index 531aed22..6fe44f1d 100644 --- a/src/notification.c +++ b/src/notification.c @@ -34,6 +34,7 @@ #include "zenity.h" #include "util.h" +#ifdef HAVE_LIBNOTIFY static char *icon_file; static void @@ -233,3 +234,4 @@ zenity_notification (ZenityData *data, ZenityNotificationData *notification_data gtk_main (); } +#endif diff --git a/src/option.c b/src/option.c index af206a02..f4813450 100644 --- a/src/option.c +++ b/src/option.c @@ -76,9 +76,11 @@ static gchar *zenity_list_print_column; static gchar *zenity_list_hide_column; static gboolean zenity_list_hide_header; +#ifdef HAVE_LIBNOTIFY /* Notification Dialog Options */ static gboolean zenity_notification_active; static gboolean zenity_notification_listen; +#endif /* Progress Dialog Options */ static gboolean zenity_progress_active; @@ -527,6 +529,7 @@ static GOptionEntry list_options[] = { } }; +#ifdef HAVE_LIBNOTIFY static GOptionEntry notification_options[] = { { "notification", @@ -560,6 +563,8 @@ static GOptionEntry notification_options[] = { } }; +#endif + static GOptionEntry progress_options[] = { { "progress", @@ -927,7 +932,9 @@ zenity_option_init (void) { results->progress_data = g_new0 (ZenityProgressData, 1); results->text_data = g_new0 (ZenityTextData, 1); results->tree_data = g_new0 (ZenityTreeData, 1); +#ifdef HAVE_LIBNOTIFY results->notification_data = g_new0 (ZenityNotificationData, 1); +#endif results->color_data = g_new0 (ZenityColorData, 1); results->password_data = g_new0 (ZenityPasswordData, 1); } @@ -1109,6 +1116,7 @@ zenity_list_pre_callback (GOptionContext *context, return TRUE; } +#ifdef HAVE_LIBNOTIFY static gboolean zenity_notification_pre_callback (GOptionContext *context, GOptionGroup *group, @@ -1120,6 +1128,7 @@ zenity_notification_pre_callback (GOptionContext *context, return TRUE; } +#endif static gboolean zenity_progress_pre_callback (GOptionContext *context, @@ -1443,6 +1452,7 @@ zenity_list_post_callback (GOptionContext *context, return TRUE; } +#ifdef HAVE_LIBNOTIFY static gboolean zenity_notification_post_callback (GOptionContext *context, GOptionGroup *group, @@ -1462,6 +1472,7 @@ zenity_notification_post_callback (GOptionContext *context, return TRUE; } +#endif static gboolean zenity_progress_post_callback (GOptionContext *context, @@ -1714,7 +1725,8 @@ zenity_create_context (void) g_option_group_set_error_hook (a_group, zenity_option_error_callback); g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); - + +#ifdef HAVE_LIBNOTIFY /* Adds notification option entries */ a_group = g_option_group_new("notification", N_("Notification icon options"), @@ -1725,6 +1737,7 @@ zenity_create_context (void) g_option_group_set_error_hook (a_group, zenity_option_error_callback); g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); +#endif /* Adds progress option entries */ a_group = g_option_group_new("progress", diff --git a/src/option.h b/src/option.h index 076b4c77..ac550b3d 100644 --- a/src/option.h +++ b/src/option.h @@ -44,7 +44,9 @@ typedef enum { MODE_WARNING, MODE_SCALE, MODE_INFO, +#ifdef HAVE_LIBNOTIFY MODE_NOTIFICATION, +#endif MODE_COLOR, MODE_PASSWORD, MODE_ABOUT, @@ -71,7 +73,9 @@ typedef struct { ZenityProgressData *progress_data; ZenityTextData *text_data; ZenityTreeData *tree_data; +#ifdef HAVE_LIBNOTIFY ZenityNotificationData *notification_data; +#endif ZenityColorData *color_data; ZenityPasswordData *password_data; } ZenityParsingOptions; diff --git a/src/zenity.h b/src/zenity.h index ecde3db6..537f5f0c 100644 --- a/src/zenity.h +++ b/src/zenity.h @@ -121,10 +121,12 @@ typedef struct { const gchar **data; } ZenityTreeData; +#ifdef HAVE_LIBNOTIFY typedef struct { gchar *notification_text; gboolean listen; } ZenityNotificationData; +#endif typedef struct { gchar *color; @@ -152,8 +154,11 @@ void zenity_text (ZenityData *data, ZenityTextData *text_data); void zenity_tree (ZenityData *data, ZenityTreeData *tree_data); +#ifdef HAVE_LIBNOTIFY void zenity_notification (ZenityData *data, ZenityNotificationData *notification_data); +#endif + void zenity_colorselection (ZenityData *data, ZenityColorData *notification_data); void zenity_scale (ZenityData *data, -- cgit