[anjuta] anjuta: Port to G(tk)Application



commit f2df91145d1c67d5f5e3cca21ce124021a7c5fdb
Author: Johannes Schmid <jhs gnome org>
Date:   Wed Dec 8 19:30:43 2010 +0100

    anjuta: Port to G(tk)Application
    
    Somehow I feel like horribly misusing this API but the example are so bad that
    I have no idea how to implement that cleanly. Seems to work though.

 configure.ac |    2 -
 src/anjuta.c |  189 ++++++++++++++++++++++++++++++++++++++++++---------------
 src/anjuta.h |   30 ++++++++-
 src/main.c   |  144 ++++++++++++++-------------------------------
 4 files changed, 209 insertions(+), 156 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ab897ff..0debacf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,6 @@ VTE_REQUIRED=0.13.1
 LIBXML_REQUIRED=2.4.23
 GDL_REQUIRED=2.91.1
 LIBWNCK_REQUIRED=2.12
-UNIQUE_REQUIRED=2.90.1
 
 dnl GtkSourceView
 GTKSOURCEVIEW_REQUIRED=2.10.5
@@ -149,7 +148,6 @@ dnl Check base modules
 
 PKG_CHECK_MODULES([ANJUTA],
    [gthread-2.0 >= $GTHREAD_REQUIRED
-	unique-3.0 >= $UNIQUE_REQUIRED
 	glib-2.0 >= $GLIB_REQUIRED
 	gio-2.0 >= $GLIB_REQUIRED
 	gtk+-3.0 >= $GTK_REQUIRED
diff --git a/src/anjuta.c b/src/anjuta.c
index a60c50e..a3f9c9f 100644
--- a/src/anjuta.c
+++ b/src/anjuta.c
@@ -24,6 +24,7 @@
 #include <libanjuta/anjuta-utils.h>
 #include <libanjuta/anjuta-save-prompt.h>
 #include <libanjuta/anjuta-plugin-manager.h>
+#include <libanjuta/resources.h>
 #include <libanjuta/interfaces/ianjuta-file-loader.h>
 #include <libanjuta/interfaces/ianjuta-file.h>
 
@@ -37,6 +38,8 @@
 #define DEFAULT_PROFILE "file://"PACKAGE_DATA_DIR"/profiles/default.profile"
 #define USER_PROFILE_NAME "user"
 
+#define ANJUTA_PIXMAP_SPLASH_SCREEN       "anjuta_splash.png"
+
 static gchar *system_restore_session = NULL;
 
 static gboolean
@@ -47,12 +50,12 @@ on_anjuta_delete_event (AnjutaApp *app, GdkEvent *event, gpointer data)
 	AnjutaProfile *current_profile;
 	AnjutaSavePrompt *save_prompt;
 	gchar *remembered_plugins;
-	
+
 	DEBUG_PRINT ("%s", "AnjutaApp delete event");
-	
+
 	plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_SHELL (app), NULL);
 	profile_manager = anjuta_shell_get_profile_manager (ANJUTA_SHELL (app), NULL);
-	
+
 	/* Save remembered plugins */
 	remembered_plugins =
 		anjuta_plugin_manager_get_remembered_plugins (plugin_manager);
@@ -60,7 +63,7 @@ on_anjuta_delete_event (AnjutaApp *app, GdkEvent *event, gpointer data)
 	                       ANJUTA_REMEMBERED_PLUGINS,
 	                       remembered_plugins);
 	g_free (remembered_plugins);
-	
+
 	/* Check for unsaved data */
 	save_prompt = anjuta_save_prompt_new (GTK_WINDOW (app));
 	anjuta_shell_save_prompt (ANJUTA_SHELL (app), save_prompt, NULL);
@@ -89,7 +92,7 @@ on_anjuta_delete_event (AnjutaApp *app, GdkEvent *event, gpointer data)
 			g_main_context_iteration (NULL, TRUE);
 		}
 	}
-	
+
 	/* If current active profile is "user", save current session as
 	 * default session
 	 */
@@ -101,11 +104,11 @@ on_anjuta_delete_event (AnjutaApp *app, GdkEvent *event, gpointer data)
 		anjuta_shell_session_save (ANJUTA_SHELL (app), session_dir, NULL);
 		g_free (session_dir);
 	}
-	
+
 	anjuta_shell_notify_exit (ANJUTA_SHELL (app), NULL);
-	
+
 	gtk_widget_destroy (GTK_WIDGET (save_prompt));
-	
+
 	/* Shutdown */
 	if (g_object_get_data (G_OBJECT (app), "__proper_shutdown"))
 	{
@@ -120,7 +123,7 @@ static void
 on_anjuta_destroy (GtkWidget * w, gpointer data)
 {
 	DEBUG_PRINT ("%s", "AnjutaApp destroy event");
-	
+
 	gtk_widget_hide (w);
 	gtk_main_quit ();
 }
@@ -131,13 +134,13 @@ on_profile_scoped (AnjutaProfileManager *profile_manager,
 {
 	gchar *session_dir;
 	static gboolean first_time = TRUE;
-	
+
 	DEBUG_PRINT ("Profile scoped: %s", anjuta_profile_get_name (profile));
 	if (strcmp (anjuta_profile_get_name (profile), USER_PROFILE_NAME) != 0)
 		return;
-	
+
 	DEBUG_PRINT ("%s", "User profile loaded; Restoring user session");
-	
+
 	/* If profile scoped to "user", restore user session */
 	if (system_restore_session)
 	{
@@ -148,7 +151,7 @@ on_profile_scoped (AnjutaProfileManager *profile_manager,
 	{
 		session_dir = USER_SESSION_PATH_NEW;
 	}
-	
+
 	if (first_time)
 	{
 		first_time = FALSE;
@@ -163,7 +166,7 @@ on_profile_scoped (AnjutaProfileManager *profile_manager,
 		anjuta_session_sync (session);
 		g_object_unref (session);
 	}
-	
+
 	/* Restore session */
 	anjuta_shell_session_load (ANJUTA_SHELL (app), session_dir, NULL);
 	g_free (session_dir);
@@ -174,16 +177,16 @@ on_profile_descoped (AnjutaProfileManager *profile_manager,
 					 AnjutaProfile *profile, AnjutaApp *app)
 {
 	gchar *session_dir;
-	
+
 	DEBUG_PRINT ("Profile descoped: %s", anjuta_profile_get_name (profile));
 	if (strcmp (anjuta_profile_get_name (profile), USER_PROFILE_NAME) != 0)
 		return;
-	
+
 	DEBUG_PRINT ("%s", "User profile descoped; Saving user session");
-	
+
 	/* If profile descoped from is "user", save user session */
 	session_dir = USER_SESSION_PATH_NEW;
-	
+
 	/* Save current session */
 	anjuta_shell_session_save (ANJUTA_SHELL (app), session_dir, NULL);
 	g_free (session_dir);
@@ -198,12 +201,12 @@ extract_project_from_session (const gchar* session_dir)
 	AnjutaSession *session;
 	GList *node, *files;
 	gchar *project_uri = NULL;
-	
+
 	session = anjuta_session_new (session_dir);
-	
+
 	files = anjuta_session_get_string_list (session, "File Loader", "Files");
 	g_object_unref (session);
-	
+
 	/* Find project file */
 	node = files;
 	for (node = files; node != NULL; node = g_list_next (node))
@@ -223,15 +226,14 @@ extract_project_from_session (const gchar* session_dir)
 		}
 	}
 	g_list_free (files);
-	
+
 	return project_uri;
 }
 
 /* FIXME: Clean this mess */
 AnjutaApp*
-anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
+create_window (GFile **files, int n_files, gboolean no_splash,
 			gboolean no_session, gboolean no_files,
-			const gchar *im_file,
 			gboolean proper_shutdown, const gchar *geometry)
 {
 	AnjutaPluginManager *plugin_manager;
@@ -244,15 +246,27 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 	gchar *project_uri = NULL;
 	gchar *template_uri = NULL;
 	gchar *profile_name = NULL;
+	gchar *im_file = NULL;
 	GError *error = NULL;
-	
+
 	/* Initialize application */
 	app = ANJUTA_APP (anjuta_app_new ());
 	status = anjuta_shell_get_status (ANJUTA_SHELL (app), NULL);
 	anjuta_status_progress_add_ticks (status, 1);
+
+	/* Initialize application */
+	im_file = anjuta_res_get_pixmap_file (ANJUTA_PIXMAP_SPLASH_SCREEN);
 	
+	gtk_window_set_role (GTK_WINDOW (app), "anjuta-app");
+	gtk_window_set_auto_startup_notification(TRUE);
+	gtk_window_set_default_icon_name ("anjuta");
+	gtk_window_set_auto_startup_notification(FALSE);
+
 	if (im_file)
+	{
 		anjuta_status_set_splash (status, im_file, 100);
+		g_free (im_file);
+	}
 	if (no_splash)
 		anjuta_status_disable_splash (status, no_splash);
 
@@ -268,7 +282,7 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 													   NULL);
 	profile_manager = anjuta_shell_get_profile_manager (ANJUTA_SHELL (app),
 														NULL);
-	
+
 	/* Restore remembered plugins */
 	remembered_plugins =
 		g_settings_get_string (app->settings, ANJUTA_REMEMBERED_PLUGINS);
@@ -276,7 +290,7 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 		anjuta_plugin_manager_set_remembered_plugins (plugin_manager,
 													  remembered_plugins);
 	g_free (remembered_plugins);
-	
+
 	/* Prepare profile */
 	profile = anjuta_profile_new (USER_PROFILE_NAME, plugin_manager);
 	session_profile = g_file_new_for_uri (DEFAULT_PROFILE);
@@ -289,7 +303,7 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 		error = NULL;
 	}
 	g_object_unref (session_profile);
-	
+
 	/* Load user session profile */
 	profile_name = g_path_get_basename (DEFAULT_PROFILE);
 	session_profile = anjuta_util_get_user_cache_file (profile_name, NULL);
@@ -304,10 +318,10 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 			error = NULL;
 		}
 	}
-	anjuta_profile_set_sync_file (profile, session_profile); 
+	anjuta_profile_set_sync_file (profile, session_profile);
 	g_object_unref (session_profile);
 	g_free (profile_name);
-	
+
 	/* Load profile */
 	anjuta_profile_manager_freeze (profile_manager);
 	anjuta_profile_manager_push (profile_manager, profile, &error);
@@ -317,43 +331,46 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 		g_error_free (error);
 		error = NULL;
 	}
-	
+
 	if (files || geometry)
-	{                 
+	{
 		gchar *session_dir;
 		AnjutaSession *session;
-		gchar **node;
+		gint i;
 		GList *files_load = NULL;
-		
+
 		/* Reset default session */
 		session_dir = USER_SESSION_PATH_NEW;
-		
+
 		project_uri = extract_project_from_session (session_dir);
 		template_uri = NULL;
-		
+
 		session = anjuta_session_new (session_dir);
 		anjuta_session_clear (session);
 		if (geometry)
 			anjuta_session_set_string (session, "Anjuta", "Geometry",
 									   geometry);
-		
+
 		/* Identify non-project files and set them for loading in session */
-		for (node = files; *node != NULL; node++)
+		for (i = 0; i < n_files; i++)
 		{
-			if (anjuta_util_is_project_file (*node))
+			gchar* file = g_file_get_path (files[i]);
+			if (!file)
+				continue;
+			if (anjuta_util_is_project_file (file))
 			{
 				/* Pick up the first project file for loading later */
 				g_free (project_uri);
-				project_uri = g_strdup (*node);
+				project_uri = g_strdup (file);
 			}
-			else if (anjuta_util_is_template_file (*node))
+			else if (anjuta_util_is_template_file (file))
 			{
 				g_free (template_uri);
-				template_uri = g_strdup (*node);
+				template_uri = g_strdup (file);
 			}
 			else
 			{
-				files_load = g_list_prepend (files_load, *node);
+				files_load = g_list_prepend (files_load, g_strdup (file));
 			}
 		}
 		if (files_load)
@@ -371,10 +388,10 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 	{
 		gchar *session_dir;
 		AnjutaSession *session;
-		
+
 		/* Load user session */
 		session_dir = USER_SESSION_PATH_NEW;
-		
+
 		/* If preferences is set to not load last session, clear it */
 		if (no_session ||
 			g_settings_get_boolean (app->settings,
@@ -403,7 +420,7 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 		}
 		g_free (session_dir);
 	}
-	
+
 	/* Prepare for session save and load on profile change */
 	g_signal_connect (profile_manager, "profile-scoped",
 					  G_CALLBACK (on_profile_scoped), app);
@@ -419,7 +436,7 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 	}
 	g_free (project_uri);
 	anjuta_profile_manager_thaw (profile_manager, &error);
-	
+
 	if (error)
 	{
 		anjuta_util_dialog_error (GTK_WINDOW (app), "%s", error->message);
@@ -428,10 +445,10 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 	}
 	g_signal_connect (profile_manager, "profile-descoped",
 					  G_CALLBACK (on_profile_descoped), app);
-	
+
 	anjuta_status_progress_tick (status, NULL, _("Loaded Sessionâ?¦"));
 	anjuta_status_disable_splash (status, TRUE);
-	
+
 	/* Load template file */
 	if (template_uri != NULL)
 	{
@@ -443,6 +460,78 @@ anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
 		g_free (template_uri);
 		g_object_unref (file);
 	}
-	
+
 	return app;
 }
+
+/* Application */
+
+G_DEFINE_TYPE (Anjuta, anjuta, GTK_TYPE_APPLICATION)
+
+static void
+anjuta_finalize (GObject *object)
+{
+  G_OBJECT_CLASS (anjuta_parent_class)->finalize (object);
+}
+
+static void
+anjuta_open (GApplication *application,
+			 GFile **files,
+			 gint n_files,
+			 const gchar* hint)
+{
+	int i;
+	GList* windows = gtk_application_get_windows (GTK_APPLICATION (application));
+	AnjutaApp *app = ANJUTA_APP (windows->data);
+	IAnjutaFileLoader* loader =
+		anjuta_shell_get_interface(ANJUTA_SHELL(app), IAnjutaFileLoader, NULL);
+	
+	if (!loader)
+		return;
+		
+	for (i = 0; i < n_files; i++)
+	{
+		ianjuta_file_loader_load(loader, files[i], FALSE, NULL);
+	}
+}
+
+static void
+anjuta_activate (GApplication *application)
+{
+	/* Show first window */
+	GList* windows = gtk_application_get_windows (GTK_APPLICATION (application));
+	
+	gtk_window_present (GTK_WINDOW (windows->data));
+}
+
+static void
+anjuta_init (Anjuta *anjuta)
+{
+
+}
+
+static void
+anjuta_class_init (AnjutaClass *klass)
+{
+	GObjectClass* object_class = G_OBJECT_CLASS (klass);
+	GApplicationClass* app_class = G_APPLICATION_CLASS (klass);
+
+	object_class->finalize = anjuta_finalize;
+
+	app_class->open = anjuta_open;
+	app_class->activate = anjuta_activate;
+}
+
+Anjuta*
+anjuta_new (void)
+{
+  g_type_init ();
+
+  return g_object_new (anjuta_get_type (),
+                       "application-id", "org.gnome.anjuta",
+                       "flags", G_APPLICATION_HANDLES_OPEN,
+                       NULL);
+}
+
+/* End */
+
diff --git a/src/anjuta.h b/src/anjuta.h
index c6fa538..28a921a 100644
--- a/src/anjuta.h
+++ b/src/anjuta.h
@@ -24,9 +24,31 @@
 #include <libanjuta/e-splash.h>
 #include "anjuta-app.h"
 
-AnjutaApp* anjuta_new (gchar *prog_name, gchar **files, gboolean no_splash,
-					   gboolean no_session, gboolean no_files,
-					   const gchar *im_file, gboolean proper_shutdown,
-					   const gchar *geometry);
+#define ANJUTA_TYPE_ANJUTA     (anjuta_get_type ())
+#define ANJUTA(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), ANJUTA_TYPE_ANJUTA, Anjuta))
+#define ANJUTA_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), ANJUTA_TYPE_APP, AnjutaClass))
+#define ANJUTA_IS_ANJUTA(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), ANJUTA_TYPE_APP))
+#define ANJUTA_IS_ANJUTA_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ANJUTA_TYPE_APP))
+
+typedef struct _Anjuta Anjuta;
+typedef struct _AnjutaClass AnjutaClass;
+
+struct _AnjutaClass
+{
+	GtkApplicationClass parent;
+};
+
+struct _Anjuta
+{
+	GtkApplication parent;
+};
+
+GType anjuta_get_type (void);
+Anjuta *anjuta_new (void);
+
+AnjutaApp*
+create_window (GFile **files, int n_files, gboolean no_splash,
+			gboolean no_session, gboolean no_files,
+			gboolean proper_shutdown, const gchar *geometry);
 
 #endif
diff --git a/src/main.c b/src/main.c
index 2ccfd85..a5d15a8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -30,17 +30,13 @@
 #include <stdlib.h>
 
 #include <gtk/gtk.h>
-#include <unique/unique.h>
-#include <libanjuta/resources.h>
 #include <libanjuta/anjuta-debug.h>
-#include <libanjuta/interfaces/ianjuta-file-loader.h>
 
 #include "anjuta.h"
 
-#define ANJUTA_PIXMAP_SPLASH_SCREEN       "anjuta_splash.png"
-
-/* App */
-static AnjutaApp *app = NULL;
+#ifdef ENABLE_NLS
+#include <locale.h>
+#endif
 
 /* Command line options */
 static gboolean no_splash = 0;
@@ -117,55 +113,26 @@ static const GOptionEntry anjuta_options[] = {
 	{NULL}
 };
 
-static UniqueResponse
-message_received_cb (UniqueApp         *unique,
-					 UniqueCommand      command,
-					 UniqueMessageData *message,
-					 guint              time_,
-					 gpointer           user_data)
+static void
+free_files (GFile** files, gint n_files)
 {
-	UniqueResponse res;
-	
-	switch (command)
+	gint i;
+	for (i = 0; i < n_files; i++)
 	{
-		case UNIQUE_ACTIVATE:
-			/* move the main window to the screen that sent us the command */
-			gtk_window_set_screen (GTK_WINDOW (app), unique_message_data_get_screen (message));
-			gtk_window_present (GTK_WINDOW (app));
-			res = UNIQUE_RESPONSE_OK;
-			break;
-		case UNIQUE_OPEN:
-		{
-			gchar** uris = unique_message_data_get_uris(message);
-			gchar** uri;
-			for (uri = uris; *uri != NULL; uri++)
-			{
-				IAnjutaFileLoader* loader =
-					anjuta_shell_get_interface(ANJUTA_SHELL(app), IAnjutaFileLoader, NULL);
-				GFile* gfile = g_file_new_for_uri(*uri);
-				ianjuta_file_loader_load(loader, gfile, FALSE, NULL);
-				g_object_unref (gfile);
-			}
-			g_strfreev(uris);
-			res = UNIQUE_RESPONSE_OK;
-			break;
-		}
-		default:
-			res = UNIQUE_RESPONSE_OK;
-			break;
+		g_object_unref (files[i]);
 	}
-	
-	return res;
+	g_free (files);
 }
 
-
 int
 main (int argc, char *argv[])
 {
 	GOptionContext *context;
 	GError* error = NULL;
-	gchar* im_file;
-	UniqueApp* unique;
+	Anjuta* anjuta;
+	GFile** files = NULL;
+	gint n_files = 0;
+	gint status;
 	
 	context = g_option_context_new (_("- Integrated Development Environment"));
 #ifdef ENABLE_NLS
@@ -179,13 +146,6 @@ main (int argc, char *argv[])
 #endif
 	
 	g_option_context_add_group (context, gtk_get_option_group (TRUE));
-	
-    /* Initialize threads, if possible */
-#ifdef G_THREADS_ENABLED    
-    if (!g_thread_supported()) g_thread_init(NULL);
-#else
-#warning "Some plugins won't work without thread support"
-#endif
     
 	/* Initialize gnome program */
 	if (!g_option_context_parse (context, &argc, &argv, &error))
@@ -194,6 +154,11 @@ main (int argc, char *argv[])
 		exit(1);
 	}
 	
+	/* Init gtk+ */
+	gtk_init (&argc, &argv);
+    /* Initialize threads */
+	g_thread_init(NULL);
+	
 	/* Init debug helpers */
 	anjuta_debug_init ();
 
@@ -202,63 +167,42 @@ main (int argc, char *argv[])
 	 * directory can still open the files */
 	if (anjuta_filenames)
 	{
+		files = g_new0 (GFile*, 1);
 		gchar** filename;
 		for (filename = anjuta_filenames; *filename != NULL; filename++)
 		{
-			GFile* file = anjuta_util_file_new_for_commandline_arg(*filename);
-			g_free (*filename);
-			*filename = g_file_get_uri (file);
-			g_object_unref (file);
+			GFile* file = g_file_new_for_commandline_arg(*filename);
+			files = g_realloc (files, (n_files + 1) * sizeof (GFile*));
+			files[n_files++] = file;
 		}
 	}
 
-	unique = unique_app_new ("org.gnome.anjuta", NULL);
+	g_set_application_name (_("Anjuta"));
+	anjuta = anjuta_new ();
+	g_application_register (G_APPLICATION (anjuta), NULL, NULL);
+
 	
-	if (unique_app_is_running(unique))
-	{
-		UniqueResponse response;
-		
-		if (!no_client)
+	if (g_application_get_is_remote (G_APPLICATION (anjuta)) && !no_client)
+	{	
+		if (files)
 		{
-			if (anjuta_filenames)
-			{
-				UniqueMessageData* message = unique_message_data_new();
-				if (!unique_message_data_set_uris (message, anjuta_filenames))
-					g_warning("Set uris failed");
-				response = unique_app_send_message (unique, UNIQUE_OPEN, message);
-				unique_message_data_free(message);
-			}
-			response = unique_app_send_message (unique, UNIQUE_ACTIVATE, NULL);
-			
-			/* we don't need the application instance anymore */
-			g_object_unref (unique);
-			
-			if (response == UNIQUE_RESPONSE_OK)
-				return 0;
-			else
-				DEBUG_PRINT("Failed to contact first instance, starting up normally");
+			g_application_open (G_APPLICATION (anjuta), files, n_files, "");
+			free_files (files, n_files);
 		}
 	}
+	else
+	{
+		AnjutaApp *app = create_window (files, n_files,
+										no_session, no_client, no_files,
+										proper_shutdown, anjuta_geometry);
+		gtk_window_set_application (GTK_WINDOW (app), GTK_APPLICATION (anjuta));
+		gtk_widget_show (GTK_WIDGET (app));
+		
+		free_files (files, n_files);
+	}
 	
-	/* Init gtk+ */
-	gtk_init (&argc, &argv);
-	g_set_application_name (_("Anjuta"));
-	gtk_window_set_default_icon_name ("anjuta");
-	gtk_window_set_auto_startup_notification(FALSE);
-	
-	/* Initialize application */
-	im_file = anjuta_res_get_pixmap_file (ANJUTA_PIXMAP_SPLASH_SCREEN);
-	app = anjuta_new (argv[0], anjuta_filenames, no_splash, no_session, no_files,
-					  im_file, proper_shutdown, anjuta_geometry);
-	g_signal_connect (unique, "message-received", G_CALLBACK (message_received_cb), NULL);
-	
-	g_free (im_file);
-	gtk_window_set_role (GTK_WINDOW (app), "anjuta-app");
-	
-	/* Run Anjuta application */
-	gtk_window_set_auto_startup_notification(TRUE);
-	gtk_widget_show (GTK_WIDGET (app));
-	gtk_main();
+	status = g_application_run (G_APPLICATION (anjuta), argc, argv);
+	g_object_unref (anjuta);
 	
-	return 0;
+	return status;
 }



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