[libgda/gtk3] Use GtkApplication instead of libunique



commit cb69813d04f0dfccc801cb60db87c1808b2ef1b0
Author: Vivien Malerba <malerba gnome-db org>
Date:   Fri Mar 11 14:38:31 2011 +0100

    Use GtkApplication instead of libunique

 configure.ac               |   27 +--------------
 control-center/Makefile.am |    3 +-
 control-center/main.c      |   79 +++++++++----------------------------------
 3 files changed, 20 insertions(+), 89 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2c92b15..6686d8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,7 +40,7 @@ m4_undefine([minor])
 m4_undefine([micro])
 
 dnl required versions of other tools.
-m4_define([req_ver_glib],[2.12.11])
+m4_define([req_ver_glib],[2.28.0])
 
 #
 # Making releases:
@@ -262,29 +262,6 @@ AC_SUBST(GRAPHVIZ_LIBS)
 
 
 dnl ******************************
-dnl Checks for LibUnique
-dnl ******************************
-have_unique=no
-AC_ARG_WITH(unique,
-	AS_HELP_STRING([--with-unique], [Use LibUnique to have only one control center]),
-	,with_unique=auto)
-
-if test "$with_unique" = "auto" -o "$with_unique" = "yes"
-then
-	PKG_CHECK_MODULES(UNIQUE, "unique-3.0", [
-		AC_DEFINE(HAVE_UNIQUE, [1], [LibUnique support enabled])
-		have_unique=yes], [
-		if test "$with_unique" = "yes"
-		then
-			AC_MSG_ERROR([LibUnique support requested but not found.])
-		fi
-		have_unique=no])
-fi
-AM_CONDITIONAL(HAVE_UNIQUE, test x"$have_unique" = "xyes")
-AC_SUBST(UNIQUE_CFLAGS)
-AC_SUBST(UNIQUE_LIBS)
-
-dnl ******************************
 dnl Checks for iso codes
 dnl ******************************
 
@@ -499,7 +476,7 @@ dnl ******************************
 dnl gtk-doc
 dnl ******************************
 
-GTK_DOC_CHECK([1.0])
+GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
 
 dnl ******************************
 dnl Checks for providers
diff --git a/control-center/Makefile.am b/control-center/Makefile.am
index 7fe690c..4a709f9 100644
--- a/control-center/Makefile.am
+++ b/control-center/Makefile.am
@@ -9,7 +9,6 @@ AM_CPPFLAGS = \
         $(LIBGDA_CFLAGS) \
 	$(LIBGDA_WFLAGS) \
         $(GTK_CFLAGS) \
-        $(UNIQUE_CFLAGS) \
         -DPREFIX=\""$(prefix)"\" \
         -DSYSCONFDIR=\""$(sysconfdir)"\" \
         -DDATADIR=\""$(datadir)"\" \
@@ -54,7 +53,7 @@ gda_control_center_5_0_LDADD=\
 	$(top_builddir)/libgda-ui/internal/libgda-ui-internal.la \
 	$(top_builddir)/libgda/libgda-5.0.la \
 	$(top_builddir)/libgda-ui/libgda-ui-5.0.la \
-	$(LIBGDA_LIBS) $(GTK_LIBS) $(UNIQUE_LIBS)
+	$(LIBGDA_LIBS) $(GTK_LIBS)
 
 @INTLTOOL_DESKTOP_RULE@
 
diff --git a/control-center/main.c b/control-center/main.c
index 813ee4f..01e2730 100644
--- a/control-center/main.c
+++ b/control-center/main.c
@@ -28,9 +28,6 @@
 #include "dsn-config.h"
 #include "provider-config.h"
 #include "gdaui-dsn-assistant.h"
-#ifdef HAVE_UNIQUE
-#include <unique/unique.h>
-#endif
 
 GtkWindow *main_window;
 GtkActionGroup *actions;
@@ -300,75 +297,33 @@ create_main_window (void)
 	return window;
 }
 
-#ifdef HAVE_UNIQUE
-static UniqueResponse
-message_received_cb (G_GNUC_UNUSED UniqueApp         *app,
-                     UniqueCommand      command,
-                     UniqueMessageData *message,
-                     G_GNUC_UNUSED guint              time_,
-                     gpointer           user_data)
+static void
+activate (GtkApplication *app)
 {
-	UniqueResponse res = UNIQUE_RESPONSE_OK;
-	switch (command) {
-	case UNIQUE_ACTIVATE:
-		/* move the main window to the screen that sent us the command */
-		gtk_window_set_screen (GTK_WINDOW (user_data), unique_message_data_get_screen (message));
-		gtk_window_present (GTK_WINDOW (user_data));
-		res = UNIQUE_RESPONSE_OK;
-		break;
-	default:
-		TO_IMPLEMENT;
+	static GtkWidget *window = NULL;
+
+	if (! window) {
+		gdaui_init ();
+		window = create_main_window ();
+		gtk_window_set_application (GTK_WINDOW (window), app);
+		gtk_widget_show (window);
 	}
-	return res;
 }
-#endif
 
 int
 main (int argc, char *argv[])
 {
-#ifdef HAVE_UNIQUE
-	UniqueApp *app;
-#endif
-	/*
-	str = gnome_db_gbr_get_locale_dir_path ();
-	bindtextdomain (GETTEXT_PACKAGE, str);
-	g_free (str);
-
-	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-	textdomain (GETTEXT_PACKAGE);
-	*/
-	gdaui_init ();
-	gtk_init (&argc, &argv);
-
-#ifdef HAVE_UNIQUE
-	app = unique_app_new ("org.gnome-db.gda-browser", NULL);
-	if (unique_app_is_running (app)) {
-		UniqueResponse response;
-		response = unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
-		if (response != UNIQUE_RESPONSE_OK)
-			TO_IMPLEMENT;
-		g_object_unref (app);
-		return 0;
-	}
-	else {
-		GtkWidget *main_window;
-		main_window = create_main_window ();
-		unique_app_watch_window (app, GTK_WINDOW (main_window));
-		g_signal_connect (app, "message-received", G_CALLBACK (message_received_cb), main_window);
-	}
-#else	
-	create_main_window ();
-#endif
+	GtkApplication *app;
+	gint status;
+	
+	app = gtk_application_new ("org.GnomeDb.GdaBrowser", G_APPLICATION_FLAGS_NONE);
+	g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
+	
+	status = g_application_run (G_APPLICATION (app), argc, argv);
 	
-
-	/* application loop */
-	gtk_main ();
-
-#ifdef HAVE_UNIQUE
 	g_object_unref (app);
-#endif
 
-	return 0;
+	return status;
 }
 
 static void



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