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
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

View File

@ -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;

View File

@ -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

View File

@ -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,
@ -1715,6 +1726,7 @@ zenity_create_context (void)
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",

View File

@ -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;

View File

@ -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,