Add a panel containing tasklist to bottom screen

This is implemented as a separate process, since creating and running
toplevel windows from inside Metacity has issues.

We now grab a DBus name, and exec the child process.  The child monitors
our name to know when to exit.

svn path=/trunk/; revision=153
This commit is contained in:
Colin Walters
2009-01-19 23:21:57 +00:00
parent 5afcf07782
commit 70a3434b5a
6 changed files with 128 additions and 123 deletions

View File

@ -14,6 +14,8 @@
#include <dbus/dbus-glib.h>
#include <libgnomeui/gnome-thumbnail.h>
#define SHELL_DBUS_SERVICE "org.gnome.Shell"
struct _ShellGlobal {
GObject parent;
@ -460,25 +462,13 @@ shell_global_reexec_self (ShellGlobal *global)
g_ptr_array_free (arr, TRUE);
}
/**
* shell_global_late_init
*
* Perform once-only global initialization; currently this executes
* the external tasklist process and grabs the org.gnome.Shell DBus name.
*/
void
shell_global_late_init (ShellGlobal *global)
shell_global_grab_dbus_service (ShellGlobal *global)
{
static gboolean initialized = FALSE;
GError *error = NULL;
DBusGConnection *session;
DBusGProxy *bus;
guint32 request_name_result;
const char* panel_args[] = {"gnomeshell-taskpanel", NULL};
if (initialized)
return;
initialized = TRUE;
session = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
@ -488,20 +478,32 @@ shell_global_late_init (ShellGlobal *global)
DBUS_INTERFACE_DBUS);
if (!dbus_g_proxy_call (bus, "RequestName", &error,
G_TYPE_STRING, "org.gnome.Shell",
G_TYPE_STRING, SHELL_DBUS_SERVICE,
G_TYPE_UINT, 0,
G_TYPE_INVALID,
G_TYPE_UINT, &request_name_result,
G_TYPE_INVALID)) {
g_print ("failed to acquire org.gnome.Shell: %s\n", error->message);
exit (0);
}
if (!g_spawn_async (NULL, &panel_args, NULL, G_SPAWN_SEARCH_PATH, NULL,
NULL, NULL, &error)) {
g_critical ("failed to execute %s: %s", panel_args[0], error->message);
g_clear_error (&error);
}
G_TYPE_INVALID))
{
g_print ("failed to acquire org.gnome.Shell: %s\n", error->message);
/* If we somehow got started again, it's not an error to be running
* already. So just exit 0.
*/
exit (0);
}
g_object_unref (bus);
}
void
shell_global_start_task_panel (ShellGlobal *global)
{
const char* panel_args[] = {"gnomeshell-taskpanel", SHELL_DBUS_SERVICE, NULL};
GError *error = NULL;
if (!g_spawn_async (NULL, (char**) panel_args, NULL, G_SPAWN_SEARCH_PATH, NULL,
NULL, NULL, &error))
{
g_critical ("failed to execute %s: %s", panel_args[0], error->message);
g_clear_error (&error);
}
}