gnome-control-center/gnome-control-center-libslab.patch
OBS User autobuild 63bffaa367 Accepting request 17867 from GNOME:Factory
Copy from GNOME:Factory/gnome-control-center based on submit request 17867 from user vuntz

OBS-URL: https://build.opensuse.org/request/show/17867
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gnome-control-center?expand=0&rev=27
2009-08-17 12:49:25 +00:00

238 lines
6.7 KiB
Diff

diff --git a/configure.in b/configure.in
index ec2a67b..d3cd6bb 100644
--- a/configure.in
+++ b/configure.in
@@ -95,7 +95,7 @@ COMMON_MODULES="gtk+-2.0 >= 2.15.0 dnl
gnome-desktop-2.0 >= 2.25.1"
PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES)
PKG_CHECK_MODULES(GNOMECC, $COMMON_MODULES libgnome-menu >= 2.10.1)
-PKG_CHECK_MODULES(GNOMECC_SHELL, $COMMON_MODULES libgnomeui-2.0 libgnome-menu libpanelapplet-2.0)
+PKG_CHECK_MODULES(GNOMECC_SHELL, $COMMON_MODULES libgnome-menu unique-1.0)
PKG_CHECK_MODULES(DBUS, dbus-1 dbus-glib-1)
PKG_CHECK_MODULES(GNOME_DESKTOP, gnome-desktop-2.0)
PKG_CHECK_MODULES(DEFAULT_APPLICATIONS_CAPPLET, libxml-2.0)
@@ -121,14 +121,9 @@ WARN_CFLAGS="-Wall"
AC_SUBST(LIBSLAB_CFLAGS)
AC_SUBST(LIBSLAB_LIBS)
AC_SUBST(WARN_CFLAGS)
+AM_CONDITIONAL(LIBSLAB_FOR_INTERNAL_USE, test "yes" = "yes")
AM_CONDITIONAL(HAVE_LIBSLAB_DEPS, [test $have_libslab_deps = yes])
-# When copying libslab, make sure to change this to match the value specified
-# in libslab's configure.ac file
-
-LT_VERSION=1:2:1
-AC_SUBST(LT_VERSION)
-
dnl
dnl Check for Xft version 2; we build in extra functionality to the font capplet
dnl when we have it.
@@ -348,7 +343,6 @@ libwindow-settings/Makefile
libwindow-settings/gnome-window-settings-2.0.pc
po/Makefile.in
libslab/Makefile
-libslab/libslab.pc
shell/Makefile
shell/gnomecc.desktop.in
typing-break/Makefile
diff --git a/libslab/Makefile.am b/libslab/Makefile.am
index 520c61e..771e840 100644
--- a/libslab/Makefile.am
+++ b/libslab/Makefile.am
@@ -26,7 +26,11 @@ HEADER_FILES= \
system-tile.h \
tile.h
+if !LIBSLAB_FOR_INTERNAL_USE
lib_LTLIBRARIES = libslab.la
+else
+noinst_LTLIBRARIES = libslab.la
+endif
libslab_la_SOURCES = \
$(MARSHAL_GENERATED) \
@@ -53,10 +57,12 @@ libslab_la_SOURCES = \
tile-action.c \
tile.c
+if !LIBSLAB_FOR_INTERNAL_USE
libslab_includedir = $(includedir)/libslab
libslab_include_HEADERS = $(HEADER_FILES)
libslab_la_LDFLAGS = -version-info $(LT_VERSION)
+endif
libslab_la_LIBADD = $(LIBSLAB_LIBS)
@@ -65,6 +71,7 @@ search-entry-watermark.h: search-entry-watermark.svg
sed -e 's/"/\\"/g' -e 's/$$/\\/' -e 's/#000000/#%s/g' $< >> $@; \
echo '"' >> $@
+
MARSHAL_GENERATED = nld-marshal.c nld-marshal.h
nld-marshal.h: nld-marshal.list
diff --git a/libslab/app-shell.c b/libslab/app-shell.c
index 2cf8e02..ad7293d 100644
--- a/libslab/app-shell.c
+++ b/libslab/app-shell.c
@@ -138,7 +138,6 @@ create_main_window (AppShellData * app_data, const gchar * app_name, const gchar
gtk_window_set_position (GTK_WINDOW (app_data->main_app), GTK_WIN_POS_CENTER);
if (!hidden)
show_shell (app_data);
- gtk_main ();
return TRUE;
}
diff --git a/libslab/libslab.pc.in b/libslab/libslab.pc.in
deleted file mode 100644
index 101fa0f..0000000
--- a/libslab/libslab.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: libslab
-Description: Beautiful App Slab
-Requires: glib-2.0 gobject-2.0 gtk+-2.0 gnome-desktop-2.0 libgnome-menu
-Requires.private: gdk-2.0 librsvg-2.0
-Version: @VERSION@
-Libs: -L${libdir} -lslab
-Cflags: -I${includedir}/slab
diff --git a/shell/control-center.c b/shell/control-center.c
index 26f902c..c4c154d 100644
--- a/shell/control-center.c
+++ b/shell/control-center.c
@@ -20,16 +20,12 @@
#include "config.h"
-#include <string.h>
-
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <panel-applet.h>
#include <libgnome/gnome-desktop-item.h>
-#include <libgnomeui/libgnomeui.h>
-#include <dirent.h>
+#include <unique/unique.h>
-#include "app-shell.h"
-#include "slab-gnome-util.h"
+#include <libslab/slab.h>
void handle_static_action_clicked (Tile * tile, TileEvent * event, gpointer data);
static GSList *get_actions_list ();
@@ -102,13 +98,51 @@ handle_static_action_clicked (Tile * tile, TileEvent * event, gpointer data)
g_free (temp);
}
+static UniqueResponse
+message_received_cb (UniqueApp *app,
+ UniqueCommand command,
+ UniqueMessageData *message,
+ guint time,
+ gpointer user_data)
+{
+ UniqueResponse res;
+ AppShellData *app_data = user_data;
+
+ switch (command) {
+ case UNIQUE_ACTIVATE:
+ /* move the main window to the screen that sent us the command */
+ gtk_window_set_screen (GTK_WINDOW (app_data->main_app),
+ unique_message_data_get_screen (message));
+ if (!app_data->main_app_window_shown_once)
+ show_shell (app_data);
+
+ gtk_window_present_with_time (GTK_WINDOW (app_data->main_app),
+ time);
+
+ gtk_widget_grab_focus (SLAB_SECTION (app_data->filter_section)->contents);
+
+ res = UNIQUE_RESPONSE_OK;
+ break;
+ default:
+ res = UNIQUE_RESPONSE_PASSTHROUGH;
+ break;
+ }
+
+ return res;
+}
+
int
main (int argc, char *argv[])
{
gboolean hidden = FALSE;
+ UniqueApp *unique_app;
AppShellData *app_data;
GSList *actions;
- GnomeProgram *program;
+ GError *error;
+ GOptionEntry options[] = {
+ { "hide", 0, 0, G_OPTION_ARG_NONE, &hidden, N_("Hide on start (useful to preload the shell)"), NULL },
+ { NULL }
+ };
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@@ -116,20 +150,29 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
#endif
- if (argc > 1)
- {
- if (argc != 2 || strcmp ("-h", argv[1]))
- {
- printf ("Usage - gnome-control-center [-h]\n");
- printf ("Options: -h : hide on start\n");
- printf ("\tUseful if you want to autostart the control-center singleton so it can get all its slow loading done\n");
- exit (1);
- }
- hidden = TRUE;
+ error = NULL;
+ if (!gtk_init_with_args (&argc, &argv,
+ NULL, options, GETTEXT_PACKAGE, &error)) {
+ g_printerr ("%s\n", error->message);
+ g_error_free (error);
+ return 1;
}
- program = gnome_program_init ("GNOME Control Center", "0.1", LIBGNOMEUI_MODULE,
- argc, argv, NULL, NULL);
+ unique_app = unique_app_new ("org.opensuse.yast-control-center-gnome", NULL);
+ if (unique_app_is_running (unique_app)) {
+ int retval = 0;
+
+ if (!hidden) {
+ UniqueResponse response;
+ response = unique_app_send_message (unique_app,
+ UNIQUE_ACTIVATE,
+ NULL);
+ retval = (response != UNIQUE_RESPONSE_OK);
+ }
+
+ g_object_unref (unique_app);
+ return retval;
+ }
app_data = appshelldata_new ("gnomecc.menu", NULL, CONTROL_CENTER_PREFIX,
GTK_ICON_SIZE_DND, FALSE, TRUE);
@@ -142,5 +185,13 @@ main (int argc, char *argv[])
create_main_window (app_data, "MyControlCenter", _("Control Center"),
"gnome-control-center", 975, 600, hidden);
+ unique_app_watch_window (unique_app, GTK_WINDOW (app_data->main_app));
+ g_signal_connect (unique_app, "message-received",
+ G_CALLBACK (message_received_cb), app_data);
+
+ gtk_main ();
+
+ g_object_unref (unique_app);
+
return 0;
};