Add libnotify as optional in zenity instalation

This commit is contained in:
Arx Cruz 2010-11-04 17:12:52 -02:00
parent 73fcbe4c0a
commit 079254bb48
6 changed files with 40 additions and 2 deletions

View File

@ -64,7 +64,19 @@ AC_PATH_PROG([PERL],[perl],)
LIBNOTIFY_REQUIRED=0.6.1 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 # Debug

View File

@ -75,9 +75,11 @@ main (gint argc, gchar **argv) {
results->tree_data->data = (const gchar **) argv + 1; results->tree_data->data = (const gchar **) argv + 1;
zenity_tree (results->data, results->tree_data); zenity_tree (results->data, results->tree_data);
break; break;
#ifdef HAVE_LIBNOTIFY
case MODE_NOTIFICATION: case MODE_NOTIFICATION:
zenity_notification (results->data, results->notification_data); zenity_notification (results->data, results->notification_data);
break; break;
#endif
case MODE_PROGRESS: case MODE_PROGRESS:
zenity_progress (results->data, results->progress_data); zenity_progress (results->data, results->progress_data);
break; break;

View File

@ -34,6 +34,7 @@
#include "zenity.h" #include "zenity.h"
#include "util.h" #include "util.h"
#ifdef HAVE_LIBNOTIFY
static char *icon_file; static char *icon_file;
static void static void
@ -233,3 +234,4 @@ zenity_notification (ZenityData *data, ZenityNotificationData *notification_data
gtk_main (); gtk_main ();
} }
#endif

View File

@ -76,9 +76,11 @@ static gchar *zenity_list_print_column;
static gchar *zenity_list_hide_column; static gchar *zenity_list_hide_column;
static gboolean zenity_list_hide_header; static gboolean zenity_list_hide_header;
#ifdef HAVE_LIBNOTIFY
/* Notification Dialog Options */ /* Notification Dialog Options */
static gboolean zenity_notification_active; static gboolean zenity_notification_active;
static gboolean zenity_notification_listen; static gboolean zenity_notification_listen;
#endif
/* Progress Dialog Options */ /* Progress Dialog Options */
static gboolean zenity_progress_active; static gboolean zenity_progress_active;
@ -527,6 +529,7 @@ static GOptionEntry list_options[] = {
} }
}; };
#ifdef HAVE_LIBNOTIFY
static GOptionEntry notification_options[] = { static GOptionEntry notification_options[] = {
{ {
"notification", "notification",
@ -560,6 +563,8 @@ static GOptionEntry notification_options[] = {
} }
}; };
#endif
static GOptionEntry progress_options[] = { static GOptionEntry progress_options[] = {
{ {
"progress", "progress",
@ -927,7 +932,9 @@ zenity_option_init (void) {
results->progress_data = g_new0 (ZenityProgressData, 1); results->progress_data = g_new0 (ZenityProgressData, 1);
results->text_data = g_new0 (ZenityTextData, 1); results->text_data = g_new0 (ZenityTextData, 1);
results->tree_data = g_new0 (ZenityTreeData, 1); results->tree_data = g_new0 (ZenityTreeData, 1);
#ifdef HAVE_LIBNOTIFY
results->notification_data = g_new0 (ZenityNotificationData, 1); results->notification_data = g_new0 (ZenityNotificationData, 1);
#endif
results->color_data = g_new0 (ZenityColorData, 1); results->color_data = g_new0 (ZenityColorData, 1);
results->password_data = g_new0 (ZenityPasswordData, 1); results->password_data = g_new0 (ZenityPasswordData, 1);
} }
@ -1109,6 +1116,7 @@ zenity_list_pre_callback (GOptionContext *context,
return TRUE; return TRUE;
} }
#ifdef HAVE_LIBNOTIFY
static gboolean static gboolean
zenity_notification_pre_callback (GOptionContext *context, zenity_notification_pre_callback (GOptionContext *context,
GOptionGroup *group, GOptionGroup *group,
@ -1120,6 +1128,7 @@ zenity_notification_pre_callback (GOptionContext *context,
return TRUE; return TRUE;
} }
#endif
static gboolean static gboolean
zenity_progress_pre_callback (GOptionContext *context, zenity_progress_pre_callback (GOptionContext *context,
@ -1443,6 +1452,7 @@ zenity_list_post_callback (GOptionContext *context,
return TRUE; return TRUE;
} }
#ifdef HAVE_LIBNOTIFY
static gboolean static gboolean
zenity_notification_post_callback (GOptionContext *context, zenity_notification_post_callback (GOptionContext *context,
GOptionGroup *group, GOptionGroup *group,
@ -1462,6 +1472,7 @@ zenity_notification_post_callback (GOptionContext *context,
return TRUE; return TRUE;
} }
#endif
static gboolean static gboolean
zenity_progress_post_callback (GOptionContext *context, zenity_progress_post_callback (GOptionContext *context,
@ -1715,6 +1726,7 @@ zenity_create_context (void)
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group(tmp_ctx, a_group); g_option_context_add_group(tmp_ctx, a_group);
#ifdef HAVE_LIBNOTIFY
/* Adds notification option entries */ /* Adds notification option entries */
a_group = g_option_group_new("notification", a_group = g_option_group_new("notification",
N_("Notification icon options"), 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_error_hook (a_group, zenity_option_error_callback);
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group(tmp_ctx, a_group); g_option_context_add_group(tmp_ctx, a_group);
#endif
/* Adds progress option entries */ /* Adds progress option entries */
a_group = g_option_group_new("progress", a_group = g_option_group_new("progress",

View File

@ -44,7 +44,9 @@ typedef enum {
MODE_WARNING, MODE_WARNING,
MODE_SCALE, MODE_SCALE,
MODE_INFO, MODE_INFO,
#ifdef HAVE_LIBNOTIFY
MODE_NOTIFICATION, MODE_NOTIFICATION,
#endif
MODE_COLOR, MODE_COLOR,
MODE_PASSWORD, MODE_PASSWORD,
MODE_ABOUT, MODE_ABOUT,
@ -71,7 +73,9 @@ typedef struct {
ZenityProgressData *progress_data; ZenityProgressData *progress_data;
ZenityTextData *text_data; ZenityTextData *text_data;
ZenityTreeData *tree_data; ZenityTreeData *tree_data;
#ifdef HAVE_LIBNOTIFY
ZenityNotificationData *notification_data; ZenityNotificationData *notification_data;
#endif
ZenityColorData *color_data; ZenityColorData *color_data;
ZenityPasswordData *password_data; ZenityPasswordData *password_data;
} ZenityParsingOptions; } ZenityParsingOptions;

View File

@ -121,10 +121,12 @@ typedef struct {
const gchar **data; const gchar **data;
} ZenityTreeData; } ZenityTreeData;
#ifdef HAVE_LIBNOTIFY
typedef struct { typedef struct {
gchar *notification_text; gchar *notification_text;
gboolean listen; gboolean listen;
} ZenityNotificationData; } ZenityNotificationData;
#endif
typedef struct { typedef struct {
gchar *color; gchar *color;
@ -152,8 +154,11 @@ void zenity_text (ZenityData *data,
ZenityTextData *text_data); ZenityTextData *text_data);
void zenity_tree (ZenityData *data, void zenity_tree (ZenityData *data,
ZenityTreeData *tree_data); ZenityTreeData *tree_data);
#ifdef HAVE_LIBNOTIFY
void zenity_notification (ZenityData *data, void zenity_notification (ZenityData *data,
ZenityNotificationData *notification_data); ZenityNotificationData *notification_data);
#endif
void zenity_colorselection (ZenityData *data, void zenity_colorselection (ZenityData *data,
ZenityColorData *notification_data); ZenityColorData *notification_data);
void zenity_scale (ZenityData *data, void zenity_scale (ZenityData *data,