From 54d8f3b27d4e6fbf4f5295b5b868446f3f3724a8 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 22 Dec 2008 22:05:56 +0000 Subject: [PATCH] Add (+) and (-) icon artwork, and a little bit of infrastructure for them svn path=/trunk/; revision=136 --- Makefile.am | 2 +- configure.ac | 1 + data/Makefile.am | 4 +++ data/add-workspace.svg | 70 ++++++++++++++++++++++++++++++++++++++ data/remove-workspace.svg | 71 +++++++++++++++++++++++++++++++++++++++ scripts/launcher.py | 8 +++-- src/Makefile.am | 1 + src/shell-global.c | 34 +++++++++++++++++-- 8 files changed, 185 insertions(+), 6 deletions(-) create mode 100644 data/Makefile.am create mode 100644 data/add-workspace.svg create mode 100644 data/remove-workspace.svg diff --git a/Makefile.am b/Makefile.am index e0dde26be..685a80f96 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = src +SUBDIRS = src data diff --git a/configure.ac b/configure.ac index 6320855f8..76ab4bcbb 100644 --- a/configure.ac +++ b/configure.ac @@ -53,5 +53,6 @@ AC_SUBST(metacity) AC_OUTPUT([ Makefile + data/Makefile src/Makefile ]) diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 000000000..d94d46efc --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,4 @@ +imagedir = $(pkgdatadir)/images + +image_DATA = \ + add-workspace.svg diff --git a/data/add-workspace.svg b/data/add-workspace.svg new file mode 100644 index 000000000..e4afad71c --- /dev/null +++ b/data/add-workspace.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/data/remove-workspace.svg b/data/remove-workspace.svg new file mode 100644 index 000000000..60170415f --- /dev/null +++ b/data/remove-workspace.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/scripts/launcher.py b/scripts/launcher.py index e1e056cc1..28c5d91c1 100644 --- a/scripts/launcher.py +++ b/scripts/launcher.py @@ -32,6 +32,7 @@ class Launcher: top_dir = os.path.dirname(scripts_dir) self.plugin_dir = os.path.join(top_dir, "src") self.js_dir = os.path.join(top_dir, "js") + self.data_dir = os.path.join(top_dir, "data") parser = OptionParser() parser.add_option("-g", "--debug", action="store_true", @@ -89,9 +90,10 @@ class Launcher: # Now launch metacity-clutter with our plugin env=dict(os.environ) - env.update({'GNOME_SHELL_JS' : self.js_dir, - 'GI_TYPELIB_PATH' : self.plugin_dir, - 'LD_LIBRARY_PATH' : os.environ.get('LD_LIBRARY_PATH', '') + ':' + self.plugin_dir, + env.update({'GNOME_SHELL_JS' : self.js_dir, + 'GNOME_SHELL_DATADIR' : self.data_dir, + 'GI_TYPELIB_PATH' : self.plugin_dir, + 'LD_LIBRARY_PATH' : os.environ.get('LD_LIBRARY_PATH', '') + ':' + self.plugin_dir, 'GNOME_DISABLE_CRASH_DIALOG' : '1'}) if force_indirect: diff --git a/src/Makefile.am b/src/Makefile.am index 57ebbfb10..ebb7fa138 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,6 +12,7 @@ gnome_shell_cflags = \ $(MUTTER_PLUGIN_CFLAGS) \ -Itray \ -DGETTEXT_PACKAGE=gnome-shell \ + -DGNOME_SHELL_DATADIR=\"$(pkgdatadir)\" \ -DGNOME_SHELL_PKGLIBDIR=\"$(pkglibdir)\" \ -DJSDIR=\"$(pkgdatadir)/js\" diff --git a/src/shell-global.c b/src/shell-global.c index 5d57437f0..d7281285a 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -15,6 +15,7 @@ struct _ShellGlobal { MutterPlugin *plugin; ShellWM *wm; gboolean keyboard_grabbed; + const char *imagedir; }; enum { @@ -26,7 +27,8 @@ enum { PROP_SCREEN_HEIGHT, PROP_STAGE, PROP_WINDOW_GROUP, - PROP_WINDOW_MANAGER + PROP_WINDOW_MANAGER, + PROP_IMAGEDIR }; /* Signals */ @@ -96,6 +98,9 @@ shell_global_get_property(GObject *object, case PROP_WINDOW_MANAGER: g_value_set_object (value, global->wm); break; + case PROP_IMAGEDIR: + g_value_set_string (value, global->imagedir); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -103,8 +108,26 @@ shell_global_get_property(GObject *object, } static void -shell_global_init(ShellGlobal *global) +shell_global_init (ShellGlobal *global) { + const char *datadir = g_getenv ("GNOME_SHELL_DATADIR"); + char *imagedir; + + if (!datadir) + datadir = GNOME_SHELL_DATADIR; + + /* We make sure imagedir ends with a '/', since the JS won't have + * access to g_build_filename() and so will end up just + * concatenating global.imagedir to a filename. + */ + imagedir = g_build_filename (datadir, "images/", NULL); + if (g_file_test (imagedir, G_FILE_TEST_IS_DIR)) + global->imagedir = imagedir; + else + { + g_free (imagedir); + global->imagedir = g_strdup_printf ("%s/", datadir); + } } static void @@ -183,6 +206,13 @@ shell_global_class_init (ShellGlobalClass *klass) "Window management interface", SHELL_TYPE_WM, G_PARAM_READABLE)); + g_object_class_install_property (gobject_class, + PROP_IMAGEDIR, + g_param_spec_string ("imagedir", + "Image directory", + "Directory containing gnome-shell image files", + NULL, + G_PARAM_READABLE)); } /**