[gnome-shell] [ShellApp] Add quit method



commit 78e3126f97e4712541ba3e70e028a332473e30e3
Author: Colin Walters <walters verbum org>
Date:   Wed Mar 24 09:42:59 2010 -0400

    [ShellApp] Add quit method
    
    Closes the app, will be used for the panel app menu.  Note
    this is just a very primitive implementation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=613804

 src/shell-app.c |   33 +++++++++++++++++++++++++++++++++
 src/shell-app.h |    3 +++
 2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/src/shell-app.c b/src/shell-app.c
index 6c78d23..bf01a52 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -7,6 +7,8 @@
 #include "shell-global.h"
 #include "shell-enum-types.h"
 #include "display.h"
+#include "st.h"
+#include "shell-window-tracker.h"
 
 #include <string.h>
 
@@ -733,6 +735,37 @@ _shell_app_set_starting (ShellApp        *app,
     shell_app_state_transition (app, SHELL_APP_STATE_RUNNING);
 }
 
+/**
+ * shell_app_request_quit:
+ * @app: A #ShellApp
+ *
+ * Initiate an asynchronous request to quit this application.
+ * The application may interact with the user, and the user
+ * might cancel the quit request from the application UI.
+ *
+ * This operation may not be supported for all applications.
+ *
+ * Returns: %TRUE if a quit request is supported for this application
+ */
+gboolean
+shell_app_request_quit (ShellApp   *app)
+{
+  GSList *iter;
+
+  /* TODO - check for an XSMP connection; we could probably use that */
+
+  for (iter = app->windows; iter; iter = iter->next)
+    {
+      MetaWindow *win = iter->data;
+
+      if (!shell_window_tracker_is_window_interesting (win))
+        continue;
+
+      meta_window_delete (win, shell_global_get_current_time (shell_global_get ()));
+    }
+  return TRUE;
+}
+
 static void
 shell_app_init (ShellApp *self)
 {
diff --git a/src/shell-app.h b/src/shell-app.h
index de96915..22f612f 100644
--- a/src/shell-app.h
+++ b/src/shell-app.h
@@ -3,6 +3,7 @@
 #define __SHELL_APP_H__
 
 #include <clutter/clutter.h>
+#include <gio/gio.h>
 
 #include "window.h"
 
@@ -49,6 +50,8 @@ void shell_app_open_new_window (ShellApp *app);
 
 ShellAppState shell_app_get_state (ShellApp *app);
 
+gboolean shell_app_request_quit (ShellApp *app);
+
 guint shell_app_get_n_windows (ShellApp *app);
 
 GSList *shell_app_get_windows (ShellApp *app);



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