AppWell: If an application is running, activate an existing window

Instead of relaunching, pick the first window and activate
This commit is contained in:
Colin Walters
2009-07-04 17:13:13 -04:00
parent 70c51beeeb
commit 92e9bc85a1
3 changed files with 41 additions and 9 deletions

View File

@ -377,11 +377,34 @@ load_initial_windows (ShellAppMonitor *monitor)
}
}
guint
shell_app_monitor_get_window_count (ShellAppMonitor *self,
const char *appid)
/**
* shell_app_monitor_get_windows_for_app:
* @self:
* @appid: Find windows for this id
*
* Returns: (transfer container) (element-type MetaWindow): List of #MetaWindow corresponding to appid
*/
GSList *
shell_app_monitor_get_windows_for_app (ShellAppMonitor *self,
const char *appid)
{
return GPOINTER_TO_UINT (g_hash_table_lookup (self->running_appids, appid));
GHashTableIter iter;
gpointer key, value;
GSList *ret = NULL;
g_hash_table_iter_init (&iter, self->window_to_appid);
while (g_hash_table_iter_next (&iter, &key, &value))
{
MetaWindow *window = key;
const char *id = value;
if (strcmp (id, appid) != 0)
continue;
ret = g_slist_prepend (ret, window);
}
return ret;
}
static void

View File

@ -44,7 +44,7 @@ GSList *shell_app_monitor_get_most_used_apps (ShellAppMonitor *monitor,
int activity,
gint number);
guint shell_app_monitor_get_window_count (ShellAppMonitor *monitor, const char *appid);
GSList *shell_app_monitor_get_windows_for_app (ShellAppMonitor *monitor, const char *appid);
/* Get whatever's running right now */
GList *shell_app_monitor_get_running_app_ids (ShellAppMonitor *monitor);