[zenity] Add libnotify as optional in zenity instalation
- From: Arx Henrique Pereira da Cruz <arxcruz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [zenity] Add libnotify as optional in zenity instalation
- Date: Tue, 9 Nov 2010 14:30:29 +0000 (UTC)
commit 079254bb48c28f62d15270028e64308347888a76
Author: Arx Cruz <arxcruz src gnome org>
Date: Thu Nov 4 17:12:52 2010 -0200
Add libnotify as optional in zenity instalation
configure.in | 14 +++++++++++++-
src/main.c | 2 ++
src/notification.c | 2 ++
src/option.c | 15 ++++++++++++++-
src/option.h | 4 ++++
src/zenity.h | 5 +++++
6 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/configure.in b/configure.in
index 974231d..34b8681 100644
--- a/configure.in
+++ b/configure.in
@@ -64,7 +64,19 @@ AC_PATH_PROG([PERL],[perl],)
LIBNOTIFY_REQUIRED=0.6.1
-PKG_CHECK_MODULES([LIBNOTIFY],[libnotify >= $LIBNOTIFY_REQUIRED])
+AC_ARG_ENABLE([libnotify],
+ AC_HELP_STRING([--enable-libnotify], [enable libnotify support]),,
+ [enable_libnotify=yes])
+
+if test x$enable_libnotify = xyes; then
+ PKG_CHECK_MODULES([LIBNOTIFY], [libnotify >= $LIBNOTIFY_REQUIRED],
+ [HAVE_LIBNOTIFY="yes"],[HAVE_LIBNOTIFY="no"])
+ AC_SUBST([LIBNOTIFY_CFLAGS])
+ AC_SUBST([LIBNOTIFY_LIBS])
+ if test "x$HAVE_LIBNOTIFY" = "xyes"; then
+ AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify is available on this machine])
+ fi
+fi
# *******************************
# Debug
diff --git a/src/main.c b/src/main.c
index ee8fc3b..0517615 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 531aed2..6fe44f1 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 af206a0..f481345 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 076b4c7..ac550b3 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 ecde3db..537f5f0 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]