[gedit/wip/gtkapp: 10/19] Do not use an idle for the command line handling



commit 9233c879ed74549281f9a4b8b9f36bb3d7223cfb
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Tue Jul 31 10:55:29 2012 +0200

    Do not use an idle for the command line handling

 gedit/gedit-app.c |   33 ++++-----------------------------
 1 files changed, 4 insertions(+), 29 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 60af879..d3a64b7 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -304,10 +304,10 @@ get_line_column_position (const gchar      *arg,
 	g_strfreev (split);
 }
 
-static gboolean
-command_line_handler (gpointer data)
+static gint
+gedit_app_command_line (GApplication            *application,
+                        GApplicationCommandLine *command_line)
 {
-	GApplicationCommandLine *command_line = data;
 	GOptionContext *context;
 	GError *error = NULL;
 	gchar **args;
@@ -453,7 +453,6 @@ command_line_handler (gpointer data)
 		gint line_position = 0;
 		gint column_position = 0;
 		const GeditEncoding *encoding = NULL;
-		GeditApp *app;
 		GeditWindow *window;
 		gboolean doc_created = FALSE;
 
@@ -503,10 +502,8 @@ command_line_handler (gpointer data)
 			g_free (encoding_charset);
 		}
 
-		app = GEDIT_APP (g_object_get_data (G_OBJECT (command_line), "application"));
-
 		gedit_debug_message (DEBUG_APP, "Create main window");
-		window = gedit_app_create_window (app, NULL);
+		window = gedit_app_create_window (GEDIT_APP (application), NULL);
 
 		gedit_debug_message (DEBUG_APP, "Show window");
 		gtk_widget_show (GTK_WIDGET (window));
@@ -546,28 +543,6 @@ command_line_handler (gpointer data)
 	g_strfreev (remaining_args);
 	g_free (geometry);
 
-	/* we are done handling this commandline */
-	g_object_unref (command_line);
-
-	return G_SOURCE_REMOVE;
-}
-
-static gint
-gedit_app_command_line (GApplication            *application,
-                        GApplicationCommandLine *command_line)
-{
-	g_message ("command line");
-
-	/* keep the application running until we are done with this commandline */
-	g_application_hold (application);
-
-	g_object_set_data_full (G_OBJECT (command_line),
-	                        "application", application,
-	                        (GDestroyNotify)g_application_release);
-
-	g_object_ref (command_line);
-	g_idle_add (command_line_handler, command_line);
-
 	return 0;
 }
 



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