[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r2610 - GNUnet gnunet-gtk gnunet-gtk/pixmaps gnunet-gtk/src
From: |
grothoff |
Subject: |
[GNUnet-SVN] r2610 - GNUnet gnunet-gtk gnunet-gtk/pixmaps gnunet-gtk/src/common gnunet-gtk/src/include gnunet-gtk/src/plugins/fs |
Date: |
Tue, 4 Apr 2006 23:12:04 -0700 (PDT) |
Author: grothoff
Date: 2006-04-04 23:11:59 -0700 (Tue, 04 Apr 2006)
New Revision: 2610
Added:
gnunet-gtk/pixmaps/gnunet-gtk-notify.png
Modified:
GNUnet/README.debian
gnunet-gtk/AUTHORS
gnunet-gtk/configure.ac
gnunet-gtk/src/common/Makefile.am
gnunet-gtk/src/common/helper.c
gnunet-gtk/src/include/gnunetgtk_common.h
gnunet-gtk/src/plugins/fs/fs.c
Log:
Hi again.
Soo, adding libnotify support to gnunet-gtk :)
Im guessing its not so cleanly done(depending on how you wish to
structure it, but ill leave that up to the GNUnet developers ;)), but
its rather small so you shouldn't have any trouble deciding if it should
go in SVN or not)
Im unsure about the configure-ac.diff, if it is the "right thing(TM)"
(it works here with and without libnotify)
would be nice to be able to disable it altogether.
(i can't find a good autotool tutorial online)
the small diffs are included in the attached
file(three-diffs-libnotify.tar.gz).
anyways, im of to bed, good night.
/Nicklas Larsson
Modified: GNUnet/README.debian
===================================================================
--- GNUnet/README.debian 2006-04-04 05:04:05 UTC (rev 2609)
+++ GNUnet/README.debian 2006-04-05 06:11:59 UTC (rev 2610)
@@ -39,6 +39,7 @@
Additional gnunet-gtk dependencies:
libglade2-dev (unstable required!)
+libnotify-dev
For running GNUnet with the MySQL database:
Modified: gnunet-gtk/AUTHORS
===================================================================
--- gnunet-gtk/AUTHORS 2006-04-04 05:04:05 UTC (rev 2609)
+++ gnunet-gtk/AUTHORS 2006-04-05 06:11:59 UTC (rev 2610)
@@ -3,6 +3,7 @@
Code contributions also came from:
Igor Wronsky <address@hidden>
+Nicklas Larsson <address@hidden>
Nils Durner <address@hidden>
Milan <address@hidden>
Modified: gnunet-gtk/configure.ac
===================================================================
--- gnunet-gtk/configure.ac 2006-04-04 05:04:05 UTC (rev 2609)
+++ gnunet-gtk/configure.ac 2006-04-05 06:11:59 UTC (rev 2610)
@@ -228,6 +228,18 @@
AC_MSG_ERROR([gnunet-gtk requires libextractor headers])
fi
+# libnotify
+LIBNOTIFY_REQUIRED=0.3.2
+PKG_CHECK_MODULES([LIBNOTIFY], [libnotify >= $LIBNOTIFY_REQUIRED],
libnotify=yes, libnotify=no)
+AC_SUBST([LIBNOTIFY_CFLAGS])
+AC_SUBST([LIBNOTIFY_LIBS])
+AM_CONDITIONAL([ENABLE_LIBNOTIFY],[test "x$libnotify" = "xyes"])
+if test "x$libnotify" != "xyes"; then
+ AC_MSG_WARN([Library requirements (libnotify >= $LIBNOTIFY_REQUIRED) not
met; consider adjusting the PKG_CONFIG_PATH environment variable if your
libraries are in a nonstandard prefix so pkg-config can find them.])
+else
+ AC_MSG_NOTICE([** libnotify integration enabled])
+ AC_DEFINE(WITH_LIBNOTIFY, 1, [Define if libnotify is enabled])
+fi
# We define the paths here, because MinGW/GCC expands paths
# passed through the command line ("-DDATADIR=..."). This would
Added: gnunet-gtk/pixmaps/gnunet-gtk-notify.png
===================================================================
(Binary files differ)
Property changes on: gnunet-gtk/pixmaps/gnunet-gtk-notify.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: gnunet-gtk/src/common/Makefile.am
===================================================================
--- gnunet-gtk/src/common/Makefile.am 2006-04-04 05:04:05 UTC (rev 2609)
+++ gnunet-gtk/src/common/Makefile.am 2006-04-05 06:11:59 UTC (rev 2610)
@@ -2,7 +2,8 @@
-I$(top_srcdir)/intl \
-I$(top_srcdir)/src/include \
@GTK_CFLAGS@ \
- @GNUNETGTK_CFLAGS@
+ @GNUNETGTK_CFLAGS@ \
+ $(LIBNOTIFY_CFLAGS)
lib_LTLIBRARIES = \
libgnunetgtk_common.la
@@ -19,6 +20,6 @@
@GNUNETGTK_LIBS@ \
$(INTLLIBS) \
-lgnunetutil \
- -lgthread-2.0
+ -lgthread-2.0 \
+ $(LIBNOTIFY_LIBS)
-
Modified: gnunet-gtk/src/common/helper.c
===================================================================
--- gnunet-gtk/src/common/helper.c 2006-04-04 05:04:05 UTC (rev 2609)
+++ gnunet-gtk/src/common/helper.c 2006-04-05 06:11:59 UTC (rev 2610)
@@ -29,6 +29,10 @@
#define HELPER_DEBUG NO
+#ifdef WITH_LIBNOTIFY
+#include <libnotify/notify.h>
+#endif
+
typedef struct {
Semaphore * sem;
void * args;
@@ -205,6 +209,9 @@
info.note = g_strdup_vprintf(format, args);
va_end(args);
info.doPopup = doPopup;
+
+ gnunetgtk_notify(info.note, 1);
+
gtkSaveCall(&doInfoMessage,
&info);
g_free(info.note);
@@ -500,4 +507,47 @@
SEMAPHORE_FREE(cls.sig);
}
+/**
+ * Simple glue to libnotify, and others?
+ *
+ */
+void gnunetgtk_notify(const char *message, int type) {
+
+ GtkWidget * root;
+
+#ifdef WITH_LIBNOTIFY
+ NotifyNotification *libnotify;
+ NotifyUrgency libnotify_urgency = NOTIFY_URGENCY_NORMAL;
+ long libnotify_expire_timeout = NOTIFY_EXPIRES_DEFAULT;
+
+ if (!notify_is_initted()){
+ if (!notify_init ("gnunet-gtk")){
+ LOG(LOG_DEBUG,_("Could not init libnotify\n"));
+ return;
+ }
+ }
+
+ root = glade_xml_get_widget(getMainXML(),"mainWindow");
+ if(gtk_window_is_active(GTK_WINDOW(root)) == FALSE){
+ if( type == 0)
+ libnotify_urgency = NOTIFY_URGENCY_LOW;
+ else if( type == 1)
+ libnotify_urgency = NOTIFY_URGENCY_NORMAL;
+ else
+ libnotify_urgency = NOTIFY_URGENCY_CRITICAL;
+ libnotify = notify_notification_new("GNUnet: gnunet-gtk",
+ message,
+
PACKAGE_DATA_DIR"/gnunet-gtk-notify.png",
+ NULL);
+ notify_notification_set_timeout(libnotify, libnotify_expire_timeout);
+ notify_notification_set_urgency(libnotify, libnotify_urgency);
+ if (!notify_notification_show (libnotify, NULL))
+ LOG(LOG_DEBUG,_("Could not send notification\n"));
+ g_object_unref(G_OBJECT(libnotify));
+ notify_uninit();
+ }
+#endif
+
+}
+
/* end of helper.c */
Modified: gnunet-gtk/src/include/gnunetgtk_common.h
===================================================================
--- gnunet-gtk/src/include/gnunetgtk_common.h 2006-04-04 05:04:05 UTC (rev
2609)
+++ gnunet-gtk/src/include/gnunetgtk_common.h 2006-04-05 06:11:59 UTC (rev
2610)
@@ -97,4 +97,11 @@
*/
void connectGladeWithPlugins(GladeXML * xml);
+/**
+ * Sends a message to libnotify
+ *
+ *
+ */
+void gnunetgtk_notify(const char * message, int type);
+
#endif
Modified: gnunet-gtk/src/plugins/fs/fs.c
===================================================================
--- gnunet-gtk/src/plugins/fs/fs.c 2006-04-04 05:04:05 UTC (rev 2609)
+++ gnunet-gtk/src/plugins/fs/fs.c 2006-04-05 06:11:59 UTC (rev 2610)
@@ -62,6 +62,7 @@
case FSUI_download_complete:
displayDownloadComplete(event->data.DownloadProgress.uri,
event->data.DownloadProgress.filename);
+ addLogEntry(_("Download `%s' complete"),
event->data.DownloadProgress.filename); /* here or in download.c ? or call
notify directly ? */
break;
case FSUI_download_error:
BREAK();
@@ -83,11 +84,13 @@
displayUploadComplete(event->data.UploadComplete.main_filename,
event->data.UploadComplete.filename,
event->data.UploadComplete.uri);
+ addLogEntry(_("Upload `%s' complete"),
event->data.UploadComplete.main_filename); /* here or in upload.c ? or call
notify directly ? */
break;
case FSUI_upload_error:
LOG(LOG_ERROR,
_("Error while uploading: %s\n"),
event->data.message);
+ addLogEntry(_("Error while uploading `%s'"), event->data.message); /* here
or in upload.c ? */
break;
case FSUI_gnunetd_connected:
LOG(LOG_MESSAGE,
@@ -96,6 +99,7 @@
case FSUI_gnunetd_disconnected:
LOG(LOG_MESSAGE,
_("Disconnected from gnunetd.\n"));
+ addLogEntry(_("Disconnected from gnunetd.\n")); /* here or ? or call
notify directly ? */
break;
default:
BREAK();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r2610 - GNUnet gnunet-gtk gnunet-gtk/pixmaps gnunet-gtk/src/common gnunet-gtk/src/include gnunet-gtk/src/plugins/fs,
grothoff <=