aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXan Lopez <xlopez@igalia.com>2011-08-29 21:49:08 +0800
committerXan Lopez <xlopez@igalia.com>2011-08-29 21:49:08 +0800
commit540c0c0ac46399462dfad2c3fd0a50a412882307 (patch)
treee030bf92f223f7b35e30b3e06a430b9a82e8d9ba /src
parente6785d3ccc5a5a7c933a50b1a224fc01ee741c9c (diff)
downloadgsoc2013-epiphany-540c0c0ac46399462dfad2c3fd0a50a412882307.tar
gsoc2013-epiphany-540c0c0ac46399462dfad2c3fd0a50a412882307.tar.gz
gsoc2013-epiphany-540c0c0ac46399462dfad2c3fd0a50a412882307.tar.bz2
gsoc2013-epiphany-540c0c0ac46399462dfad2c3fd0a50a412882307.tar.lz
gsoc2013-epiphany-540c0c0ac46399462dfad2c3fd0a50a412882307.tar.xz
gsoc2013-epiphany-540c0c0ac46399462dfad2c3fd0a50a412882307.tar.zst
gsoc2013-epiphany-540c0c0ac46399462dfad2c3fd0a50a412882307.zip
Show a notification when the newly created web-app is ready to be used
This will probably go away in 3.4 when the new dash design is introduced, but for now it's the best we have.
Diffstat (limited to 'src')
-rw-r--r--src/ephy-main.c6
-rw-r--r--src/window-commands.c35
2 files changed, 39 insertions, 2 deletions
diff --git a/src/ephy-main.c b/src/ephy-main.c
index c74b2e7ef..19b4100f8 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -35,6 +35,7 @@
#include "eggsmclient.h"
#include <libxml/xmlversion.h>
+#include <libnotify/notify.h>
#include <glib/gi18n.h>
@@ -261,6 +262,8 @@ main (int argc,
*/
LIBXML_TEST_VERSION;
+ notify_init (PACKAGE);
+
/* If we're given -remote arguments, translate them */
if (argc >= 2 && strcmp (argv[1], "-remote") == 0) {
const char *opening, *closing;
@@ -463,6 +466,9 @@ main (int argc,
/* Shutdown */
g_object_unref (ephy_shell);
+ if (notify_is_initted ())
+ notify_uninit ();
+
ephy_file_save_accels ();
ephy_state_save ();
ephy_settings_shutdown ();
diff --git a/src/window-commands.c b/src/window-commands.c
index 341ea4014..3cdbcf686 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -58,6 +58,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <webkit/webkit.h>
+#include <libnotify/notify.h>
static void
page_setup_done_cb (GtkPageSetup *setup,
@@ -503,6 +504,20 @@ fill_default_application_title (EphyApplicationDialogData *data)
gtk_entry_set_text (GTK_ENTRY (data->entry), title);
}
+static void
+notify_launch_cb (NotifyNotification *notification,
+ char *action,
+ gpointer user_data)
+{
+ char * desktop_file = user_data;
+ /* A gross hack to be able to launch epiphany from within
+ * Epiphany. Might be a good idea to figure out a better
+ * solution... */
+ g_unsetenv (EPHY_UUID_ENVVAR);
+ ephy_file_launch_desktop_file (desktop_file, NULL, 0, NULL);
+ g_free (desktop_file);
+}
+
void
window_cmd_file_save_as_application (GtkAction *action,
EphyWindow *window)
@@ -558,14 +573,30 @@ window_cmd_file_save_as_application (GtkAction *action,
if (response == GTK_RESPONSE_OK)
{
char *desktop_file;
+ char *message;
+ NotifyNotification *notification;
/* Create Web Application, including a new profile and .desktop file. */
desktop_file = ephy_web_view_create_web_application (view,
gtk_entry_get_text (GTK_ENTRY (data->entry)),
gtk_image_get_pixbuf (GTK_IMAGE (data->image)));
- /* TODO: show a notification when the app is totally
- * created and ready to be launched */
+ message = g_strdup_printf (_("The application '%s' is ready to be used"),
+ gtk_entry_get_text (GTK_ENTRY (data->entry)));
+
+ notification = notify_notification_new (message,
+ NULL, NULL);
+ g_free (message);
+ notify_notification_add_action (notification, "launch", _("Launch"),
+ (NotifyActionCallback)notify_launch_cb,
+ g_path_get_basename (desktop_file),
+ NULL);
+ notify_notification_set_icon_from_pixbuf (notification, gtk_image_get_pixbuf (GTK_IMAGE (data->image)));
+ notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT);
+ notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW);
+ notify_notification_set_hint (notification, "transient", g_variant_new_boolean (TRUE));
+ notify_notification_show (notification, NULL);
+
g_free (desktop_file);
}