[gnome-terminal] Simplify startup notification



commit 0a308ab85a7aa8cca6242e3d9de88b39983a289c
Author: Christian Persch <chpe gnome org>
Date:   Thu Aug 27 18:33:17 2009 +0200

    Simplify startup notification
    
    Use gtk_window_set_startup_id(), and remove libstartup-notification.

 configure.ac          |    4 +--
 src/terminal-app.c    |    9 ++++-
 src/terminal-window.c |   79 -------------------------------------------------
 src/terminal-window.h |    3 --
 src/terminal.c        |    4 --
 5 files changed, 8 insertions(+), 91 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ce293fc..0ae1af7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,7 +42,6 @@ AM_GLIB_GNU_GETTEXT
 GLIB_REQUIRED=2.16.0
 GTK_REQUIRED=2.14.0
 GCONF_REQUIRED=2.14.0
-STARTUP_NOTIFICATION_REQUIRED=0.8
 DBUS_GLIB_REQUIRED=0.6
 VTE_REQUIRED=0.20.0
 
@@ -53,8 +52,7 @@ PKG_CHECK_MODULES([TERM],
    gio-2.0
    gtk+-2.0 >= $GTK_REQUIRED
    gconf-2.0 >= $GCONF_REQUIRED
-   dbus-glib-1 >= $DBUS_GLIB_REQUIRED
-   libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_REQUIRED])
+   dbus-glib-1 >= $DBUS_GLIB_REQUIRED])
 
 # Check the smclient backend
 GDK_TARGET="$($PKG_CONFIG --variable target gdk-2.0)"
diff --git a/src/terminal-app.c b/src/terminal-app.c
index 136b822..6b5fc0e 100644
--- a/src/terminal-app.c
+++ b/src/terminal-app.c
@@ -1728,6 +1728,11 @@ terminal_app_handle_options (TerminalApp *app,
   /* Make sure we open at least one window */
   terminal_options_ensure_window (options);
 
+  if (options->startup_id != NULL)
+    _terminal_debug_print (TERMINAL_DEBUG_FACTORY,
+                           "Startup ID is '%s'\n",
+                           options->startup_id);
+
   for (lw = options->initial_windows;  lw != NULL; lw = lw->next)
     {
       InitialWindow *iw = lw->data;
@@ -1743,8 +1748,8 @@ terminal_app_handle_options (TerminalApp *app,
       if (iw->source_tag == SOURCE_SESSION)
         terminal_window_set_is_restored (window);
 
-      if (options->startup_id)
-        terminal_window_set_startup_id (window, options->startup_id);
+      if (options->startup_id != NULL)
+        gtk_window_set_startup_id (GTK_WINDOW (window), options->startup_id);
 
       /* Overwrite the default, unique window role set in terminal_window_init */
       if (iw->role)
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 3c7e61d..96f167b 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -26,7 +26,6 @@
 #include <gdk/gdkx.h>
 #endif
 #include <gdk/gdkkeysyms.h>
-#include <libsn/sn-launchee.h>
 
 #include "skey-popup.h"
 #include "terminal-accels.h"
@@ -66,7 +65,6 @@ struct _TerminalWindowPrivate
   int old_char_width;
   int old_char_height;
   void *old_geometry_widget; /* only used for pointer value as it may be freed */
-  char *startup_id;
 
   GtkWidget *confirm_close_dialog;
 
@@ -2090,8 +2088,6 @@ terminal_window_finalize (GObject *object)
   TerminalWindow *window = TERMINAL_WINDOW (object);
   TerminalWindowPrivate *priv = window->priv;
 
-  g_free (priv->startup_id);
-
   g_object_unref (priv->ui_manager);
 
   if (priv->confirm_close_dialog)
@@ -2110,28 +2106,10 @@ terminal_window_delete_event (GtkWidget *widget,
 }
 
 static void
-sn_error_trap_push (SnDisplay *display,
-                    Display   *xdisplay)
-{
-  gdk_error_trap_push ();
-}
-
-static void
-sn_error_trap_pop (SnDisplay *display,
-                   Display   *xdisplay)
-{
-  gdk_error_trap_pop ();
-}
-
-static void
 terminal_window_show (GtkWidget *widget)
 {
   TerminalWindow *window = TERMINAL_WINDOW (widget);
   TerminalWindowPrivate *priv = window->priv;
-  SnDisplay *sn_display;
-  SnLauncheeContext *context;
-  GdkScreen *screen;
-  GdkDisplay *display;
 
   _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
                          "[window %p] show, size %d : %d at (%d, %d)\n",
@@ -2146,54 +2124,7 @@ terminal_window_show (GtkWidget *widget)
       terminal_window_set_size (window, priv->active_screen, FALSE);
     }
 
-  context = NULL;
-  sn_display = NULL;
-  if (priv->startup_id != NULL)
-    {
-      /* Set up window for launch notification */
-
-      screen = gtk_window_get_screen (GTK_WINDOW (window));
-      display = gdk_screen_get_display (screen);
-      
-      sn_display = sn_display_new (gdk_x11_display_get_xdisplay (display),
-                                   sn_error_trap_push,
-                                   sn_error_trap_pop);
-      
-      context = sn_launchee_context_new (sn_display,
-                                         gdk_screen_get_number (screen),
-                                         priv->startup_id);
-
-      /* Handle the setup for the window if the startup_id is valid; I
-       * don't think it can hurt to do this even if it was invalid,
-       * but why do the extra work...
-       */
-      if (strncmp (sn_launchee_context_get_startup_id (context), "_TIME", 5) != 0)
-        sn_launchee_context_setup_window (context,
-                                          GDK_WINDOW_XWINDOW (widget->window));
-
-      /* Now, set the _NET_WM_USER_TIME for the new window to the timestamp
-       * that caused the window to be launched.
-       */
-      if (sn_launchee_context_get_id_has_timestamp (context))
-        {
-          gulong timestamp;
-
-          timestamp = sn_launchee_context_get_timestamp (context);
-          gdk_x11_window_set_user_time (widget->window, timestamp);
-        }
-
-      g_free (priv->startup_id);
-      priv->startup_id = NULL;
-    }
-  
   GTK_WIDGET_CLASS (terminal_window_parent_class)->show (widget);
-
-  if (context != NULL)
-    {
-      sn_launchee_context_complete (context);
-      sn_launchee_context_unref (context);
-      sn_display_unref (sn_display);
-    }
 }
 
 TerminalWindow*
@@ -3692,16 +3623,6 @@ help_about_callback (GtkAction *action,
   g_free (licence_text);
 }
 
-void
-terminal_window_set_startup_id (TerminalWindow *window,
-                                const char     *startup_id)
-{
-  TerminalWindowPrivate *priv = window->priv;
-
-  g_free (priv->startup_id);
-  priv->startup_id = g_strdup (startup_id);
-}
-
 GtkUIManager *
 terminal_window_get_ui_manager (TerminalWindow *window)
 {
diff --git a/src/terminal-window.h b/src/terminal-window.h
index 6d0807d..43da5f2 100644
--- a/src/terminal-window.h
+++ b/src/terminal-window.h
@@ -95,9 +95,6 @@ void terminal_window_set_size_force_grid (TerminalWindow *window,
 
 GtkWidget* terminal_window_get_notebook (TerminalWindow *window);
 
-void terminal_window_set_startup_id (TerminalWindow *window,
-                                     const char     *startup_id);
-
 gboolean terminal_window_uses_argb_visual (TerminalWindow *window);
 
 void terminal_window_save_state (TerminalWindow *window,
diff --git a/src/terminal.c b/src/terminal.c
index fbc92bd..8160635 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -309,10 +309,6 @@ main (int argc, char **argv)
   if (startup_id)
     g_unsetenv ("DESKTOP_STARTUP_ID");
 
-  gtk_window_set_auto_startup_notification (FALSE); /* we'll do it ourselves due
-                                                     * to complicated factory setup
-                                                     */
-
  /* Do this here so that gdk_display is initialized */
   if (options->startup_id == NULL)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]