[gnome-shell] Allow dragging a Workspace.WindowClone into favorites well



commit a71ae65f8bcb944e312c5f99b43da2e1cb115ae4
Author: Colin Walters <walters verbum org>
Date:   Thu Jul 2 05:04:33 2009 -0400

    Allow dragging a Workspace.WindowClone into favorites well
    
    It's a natural thing to do, though in the future we may want
    to split the WindowClone into js/misc/window.js or the like.

 js/ui/appDisplay.js     |    6 ++++++
 src/shell-app-monitor.c |   13 +++++++++++++
 src/shell-app-monitor.h |    4 ++++
 3 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 730d4df..a3e9d50 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -14,6 +14,7 @@ const Mainloop = imports.mainloop;
 const AppInfo = imports.misc.appInfo;
 const DND = imports.ui.dnd;
 const GenericDisplay = imports.ui.genericDisplay;
+const Workspaces = imports.ui.workspaces;
 
 const ENTERED_MENU_COLOR = new Clutter.Color();
 ENTERED_MENU_COLOR.from_pixel(0x00ff0022);
@@ -574,6 +575,11 @@ WellArea.prototype = {
             id = source.appInfo.appId;
         } else if (source instanceof AppDisplayItem) {
             id = source.getId();
+        } else if (source instanceof Workspaces.WindowClone) {
+            let appMonitor = Shell.AppMonitor.get_default();
+            id = appMonitor.get_window_id(source.metaWindow);
+            if (id === null)
+                return false;
         } else {
             return false;
         }
diff --git a/src/shell-app-monitor.c b/src/shell-app-monitor.c
index 87b7f6c..f099610 100644
--- a/src/shell-app-monitor.c
+++ b/src/shell-app-monitor.c
@@ -545,6 +545,19 @@ shell_app_monitor_get_most_used_apps (ShellAppMonitor *monitor,
 }
 
 /**
+ * shell_app_monitor_get_window_id
+ * @monitor: An app monitor instance
+ * @metawin: A #MetaWindow
+ *
+ * Returns: (transfer full): Desktop file id associated with window
+ */
+char *
+shell_app_monitor_get_window_id (ShellAppMonitor *monitor, MetaWindow *metawin)
+{
+  return g_hash_table_lookup (monitor->window_to_appid, metawin);
+}
+
+/**
  * shell_app_monitor_get_running_app_ids:
  *
  * @monitor: An app monitor instance
diff --git a/src/shell-app-monitor.h b/src/shell-app-monitor.h
index 65bf8b0..073691b 100644
--- a/src/shell-app-monitor.h
+++ b/src/shell-app-monitor.h
@@ -5,6 +5,8 @@
 #include <glib-object.h>
 #include <glib.h>
 
+#include "window.h"
+
 /* 
  * This object provides monitoring of system application directories (.desktop files)
  * and activity-based statistics about applications usage 
@@ -35,6 +37,8 @@ GType shell_app_monitor_get_type (void) G_GNUC_CONST;
 
 ShellAppMonitor* shell_app_monitor_get_default(void);
 
+char *shell_app_monitor_get_window_id (ShellAppMonitor *monitor, MetaWindow *metawin);
+
 /* Get the most popular applications for a given activity */
 GSList *shell_app_monitor_get_most_used_apps (ShellAppMonitor *monitor,
                                               int              activity,



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