|
|
8f91ed |
From 8fa00d0a56f073e0ac44a7de33203d893af4a841 Mon Sep 17 00:00:00 2001
|
|
|
8f91ed |
From: Ignacio Casal Quinteiro <icq@gnome.org>
|
|
|
8f91ed |
Date: Thu, 19 Mar 2015 15:46:48 +0100
|
|
|
8f91ed |
Subject: [PATCH 05/26] Fix desktop actions
|
|
|
8f91ed |
|
|
|
8f91ed |
https://bugzilla.gnome.org/show_bug.cgi?id=744184
|
|
|
8f91ed |
---
|
|
|
8f91ed |
data/org.gnome.gedit.desktop.in.in | 6 +-
|
|
|
8f91ed |
gedit/gedit-app.c | 394 +++++++++++++++++++------------------
|
|
|
8f91ed |
2 files changed, 210 insertions(+), 190 deletions(-)
|
|
|
8f91ed |
|
|
|
8f91ed |
--- a/data/org.gnome.gedit.desktop.in.in
|
|
|
8f91ed |
+++ b/data/org.gnome.gedit.desktop.in.in
|
|
|
8f91ed |
@@ -16,14 +16,14 @@ X-GNOME-Bugzilla-Product=gedit
|
|
|
8f91ed |
X-GNOME-Bugzilla-Component=general
|
|
|
8f91ed |
X-GNOME-Bugzilla-Version=@VERSION@
|
|
|
8f91ed |
X-GNOME-Bugzilla-ExtraInfoScript=@FULL_LIBEXECDIR@/gedit/gedit-bugreport.sh
|
|
|
8f91ed |
-Actions=Window;Document;
|
|
|
8f91ed |
+Actions=new-window;new-document;
|
|
|
8f91ed |
_Keywords=Text;Editor;
|
|
|
8f91ed |
DBusActivatable=true
|
|
|
8f91ed |
|
|
|
8f91ed |
-[Desktop Action Window]
|
|
|
8f91ed |
+[Desktop Action new-window]
|
|
|
8f91ed |
_Name=Open a New Window
|
|
|
8f91ed |
Exec=gedit --new-window
|
|
|
8f91ed |
|
|
|
8f91ed |
-[Desktop Action Document]
|
|
|
8f91ed |
+[Desktop Action new-document]
|
|
|
8f91ed |
_Name=Open a New Document
|
|
|
8f91ed |
Exec=gedit --new-document
|
|
|
8f91ed |
--- a/gedit/gedit-app.c
|
|
|
8f91ed |
+++ b/gedit/gedit-app.c
|
|
|
8f91ed |
@@ -290,6 +290,193 @@ gedit_app_set_window_title_impl (GeditAp
|
|
|
8f91ed |
gtk_window_set_title (GTK_WINDOW (window), title);
|
|
|
8f91ed |
}
|
|
|
8f91ed |
|
|
|
8f91ed |
+static gboolean
|
|
|
8f91ed |
+is_in_viewport (GtkWindow *window,
|
|
|
8f91ed |
+ GdkScreen *screen,
|
|
|
8f91ed |
+ gint workspace,
|
|
|
8f91ed |
+ gint viewport_x,
|
|
|
8f91ed |
+ gint viewport_y)
|
|
|
8f91ed |
+{
|
|
|
8f91ed |
+ GdkScreen *s;
|
|
|
8f91ed |
+ GdkDisplay *display;
|
|
|
8f91ed |
+ GdkWindow *gdkwindow;
|
|
|
8f91ed |
+ const gchar *cur_name;
|
|
|
8f91ed |
+ const gchar *name;
|
|
|
8f91ed |
+ gint cur_n;
|
|
|
8f91ed |
+ gint n;
|
|
|
8f91ed |
+ gint ws;
|
|
|
8f91ed |
+ gint sc_width, sc_height;
|
|
|
8f91ed |
+ gint x, y, width, height;
|
|
|
8f91ed |
+ gint vp_x, vp_y;
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ /* Check for screen and display match */
|
|
|
8f91ed |
+ display = gdk_screen_get_display (screen);
|
|
|
8f91ed |
+ cur_name = gdk_display_get_name (display);
|
|
|
8f91ed |
+ cur_n = gdk_screen_get_number (screen);
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ s = gtk_window_get_screen (window);
|
|
|
8f91ed |
+ display = gdk_screen_get_display (s);
|
|
|
8f91ed |
+ name = gdk_display_get_name (display);
|
|
|
8f91ed |
+ n = gdk_screen_get_number (s);
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (strcmp (cur_name, name) != 0 || cur_n != n)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ return FALSE;
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ /* Check for workspace match */
|
|
|
8f91ed |
+ ws = gedit_utils_get_window_workspace (window);
|
|
|
8f91ed |
+ if (ws != workspace && ws != GEDIT_ALL_WORKSPACES)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ return FALSE;
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ /* Check for viewport match */
|
|
|
8f91ed |
+ gdkwindow = gtk_widget_get_window (GTK_WIDGET (window));
|
|
|
8f91ed |
+ gdk_window_get_position (gdkwindow, &x, &y);
|
|
|
8f91ed |
+ width = gdk_window_get_width (gdkwindow);
|
|
|
8f91ed |
+ height = gdk_window_get_height (gdkwindow);
|
|
|
8f91ed |
+ gedit_utils_get_current_viewport (screen, &vp_x, &vp_y);
|
|
|
8f91ed |
+ x += vp_x;
|
|
|
8f91ed |
+ y += vp_y;
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ sc_width = gdk_screen_get_width (screen);
|
|
|
8f91ed |
+ sc_height = gdk_screen_get_height (screen);
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ return x + width * .25 >= viewport_x &&
|
|
|
8f91ed |
+ x + width * .75 <= viewport_x + sc_width &&
|
|
|
8f91ed |
+ y >= viewport_y &&
|
|
|
8f91ed |
+ y + height <= viewport_y + sc_height;
|
|
|
8f91ed |
+}
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+static GeditWindow *
|
|
|
8f91ed |
+get_active_window (GtkApplication *app)
|
|
|
8f91ed |
+{
|
|
|
8f91ed |
+ GdkScreen *screen;
|
|
|
8f91ed |
+ guint workspace;
|
|
|
8f91ed |
+ gint viewport_x, viewport_y;
|
|
|
8f91ed |
+ GList *windows, *l;
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ screen = gdk_screen_get_default ();
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ workspace = gedit_utils_get_current_workspace (screen);
|
|
|
8f91ed |
+ gedit_utils_get_current_viewport (screen, &viewport_x, &viewport_y);
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ /* Gtk documentation says the window list is always in MRU order */
|
|
|
8f91ed |
+ windows = gtk_application_get_windows (app);
|
|
|
8f91ed |
+ for (l = windows; l != NULL; l = l->next)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ GtkWindow *window = l->data;
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (GEDIT_IS_WINDOW (window) && is_in_viewport (window, screen, workspace, viewport_x, viewport_y))
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ return GEDIT_WINDOW (window);
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ return NULL;
|
|
|
8f91ed |
+}
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+static void
|
|
|
8f91ed |
+set_command_line_wait (GeditApp *app,
|
|
|
8f91ed |
+ GeditTab *tab)
|
|
|
8f91ed |
+{
|
|
|
8f91ed |
+ g_object_set_data_full (G_OBJECT (tab),
|
|
|
8f91ed |
+ "GeditTabCommandLineWait",
|
|
|
8f91ed |
+ g_object_ref (app->priv->command_line),
|
|
|
8f91ed |
+ (GDestroyNotify)g_object_unref);
|
|
|
8f91ed |
+}
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+static void
|
|
|
8f91ed |
+open_files (GApplication *application,
|
|
|
8f91ed |
+ gboolean new_window,
|
|
|
8f91ed |
+ gboolean new_document,
|
|
|
8f91ed |
+ gchar *geometry,
|
|
|
8f91ed |
+ gint line_position,
|
|
|
8f91ed |
+ gint column_position,
|
|
|
8f91ed |
+ const GtkSourceEncoding *encoding,
|
|
|
8f91ed |
+ GInputStream *stdin_stream,
|
|
|
8f91ed |
+ GSList *file_list,
|
|
|
8f91ed |
+ GApplicationCommandLine *command_line)
|
|
|
8f91ed |
+{
|
|
|
8f91ed |
+ GeditWindow *window = NULL;
|
|
|
8f91ed |
+ GeditTab *tab;
|
|
|
8f91ed |
+ gboolean doc_created = FALSE;
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (!new_window)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ window = get_active_window (GTK_APPLICATION (application));
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (window == NULL)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ gedit_debug_message (DEBUG_APP, "Create main window");
|
|
|
8f91ed |
+ window = gedit_app_create_window (GEDIT_APP (application), NULL);
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ gedit_debug_message (DEBUG_APP, "Show window");
|
|
|
8f91ed |
+ gtk_widget_show (GTK_WIDGET (window));
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (geometry)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ gtk_window_parse_geometry (GTK_WINDOW (window), geometry);
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (stdin_stream)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ gedit_debug_message (DEBUG_APP, "Load stdin");
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ tab = gedit_window_create_tab_from_stream (window,
|
|
|
8f91ed |
+ stdin_stream,
|
|
|
8f91ed |
+ encoding,
|
|
|
8f91ed |
+ line_position,
|
|
|
8f91ed |
+ column_position,
|
|
|
8f91ed |
+ TRUE);
|
|
|
8f91ed |
+ doc_created = tab != NULL;
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (doc_created && command_line)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ set_command_line_wait (GEDIT_APP (application),
|
|
|
8f91ed |
+ tab);
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+ g_input_stream_close (stdin_stream, NULL, NULL);
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (file_list != NULL)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ GSList *loaded;
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ gedit_debug_message (DEBUG_APP, "Load files");
|
|
|
8f91ed |
+ loaded = _gedit_cmd_load_files_from_prompt (window,
|
|
|
8f91ed |
+ file_list,
|
|
|
8f91ed |
+ encoding,
|
|
|
8f91ed |
+ line_position,
|
|
|
8f91ed |
+ column_position);
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ doc_created = doc_created || loaded != NULL;
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (command_line)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ g_slist_foreach (loaded, (GFunc)set_command_line_wait, NULL);
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+ g_slist_free (loaded);
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (!doc_created || new_document)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ gedit_debug_message (DEBUG_APP, "Create tab");
|
|
|
8f91ed |
+ tab = gedit_window_create_tab (window, TRUE);
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ if (command_line)
|
|
|
8f91ed |
+ {
|
|
|
8f91ed |
+ set_command_line_wait (GEDIT_APP (application),
|
|
|
8f91ed |
+ tab);
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+ }
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ gtk_window_present (GTK_WINDOW (window));
|
|
|
8f91ed |
+}
|
|
|
8f91ed |
+
|
|
|
8f91ed |
static void
|
|
|
8f91ed |
new_window_activated (GSimpleAction *action,
|
|
|
8f91ed |
GVariant *parameter,
|
|
|
8f91ed |
@@ -311,6 +498,25 @@ new_window_activated (GSimpleAction *act
|
|
|
8f91ed |
}
|
|
|
8f91ed |
|
|
|
8f91ed |
static void
|
|
|
8f91ed |
+new_document_activated (GSimpleAction *action,
|
|
|
8f91ed |
+ GVariant *parameter,
|
|
|
8f91ed |
+ gpointer user_data)
|
|
|
8f91ed |
+{
|
|
|
8f91ed |
+ GApplication *application = G_APPLICATION (user_data);
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+ open_files (application,
|
|
|
8f91ed |
+ FALSE,
|
|
|
8f91ed |
+ TRUE,
|
|
|
8f91ed |
+ NULL,
|
|
|
8f91ed |
+ 0,
|
|
|
8f91ed |
+ 0,
|
|
|
8f91ed |
+ NULL,
|
|
|
8f91ed |
+ NULL,
|
|
|
8f91ed |
+ NULL,
|
|
|
8f91ed |
+ NULL);
|
|
|
8f91ed |
+}
|
|
|
8f91ed |
+
|
|
|
8f91ed |
+static void
|
|
|
8f91ed |
preferences_activated (GSimpleAction *action,
|
|
|
8f91ed |
GVariant *parameter,
|
|
|
8f91ed |
gpointer user_data)
|
|
|
8f91ed |
@@ -362,6 +568,7 @@ quit_activated (GSimpleAction *action,
|
|
|
8f91ed |
|
|
|
8f91ed |
static GActionEntry app_entries[] = {
|
|
|
8f91ed |
{ "new-window", new_window_activated, NULL, NULL, NULL },
|
|
|
8f91ed |
+ { "new-document", new_document_activated, NULL, NULL, NULL },
|
|
|
8f91ed |
{ "preferences", preferences_activated, NULL, NULL, NULL },
|
|
|
8f91ed |
{ "help", help_activated, NULL, NULL, NULL },
|
|
|
8f91ed |
{ "about", about_activated, NULL, NULL, NULL },
|
|
|
8f91ed |
@@ -639,193 +846,6 @@ gedit_app_startup (GApplication *applica
|
|
|
8f91ed |
app);
|
|
|
8f91ed |
}
|
|
|
8f91ed |
|
|
|
8f91ed |
-static gboolean
|
|
|
8f91ed |
-is_in_viewport (GtkWindow *window,
|
|
|
8f91ed |
- GdkScreen *screen,
|
|
|
8f91ed |
- gint workspace,
|
|
|
8f91ed |
- gint viewport_x,
|
|
|
8f91ed |
- gint viewport_y)
|
|
|
8f91ed |
-{
|
|
|
8f91ed |
- GdkScreen *s;
|
|
|
8f91ed |
- GdkDisplay *display;
|
|
|
8f91ed |
- GdkWindow *gdkwindow;
|
|
|
8f91ed |
- const gchar *cur_name;
|
|
|
8f91ed |
- const gchar *name;
|
|
|
8f91ed |
- gint cur_n;
|
|
|
8f91ed |
- gint n;
|
|
|
8f91ed |
- gint ws;
|
|
|
8f91ed |
- gint sc_width, sc_height;
|
|
|
8f91ed |
- gint x, y, width, height;
|
|
|
8f91ed |
- gint vp_x, vp_y;
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- /* Check for screen and display match */
|
|
|
8f91ed |
- display = gdk_screen_get_display (screen);
|
|
|
8f91ed |
- cur_name = gdk_display_get_name (display);
|
|
|
8f91ed |
- cur_n = gdk_screen_get_number (screen);
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- s = gtk_window_get_screen (window);
|
|
|
8f91ed |
- display = gdk_screen_get_display (s);
|
|
|
8f91ed |
- name = gdk_display_get_name (display);
|
|
|
8f91ed |
- n = gdk_screen_get_number (s);
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (strcmp (cur_name, name) != 0 || cur_n != n)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- return FALSE;
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- /* Check for workspace match */
|
|
|
8f91ed |
- ws = gedit_utils_get_window_workspace (window);
|
|
|
8f91ed |
- if (ws != workspace && ws != GEDIT_ALL_WORKSPACES)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- return FALSE;
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- /* Check for viewport match */
|
|
|
8f91ed |
- gdkwindow = gtk_widget_get_window (GTK_WIDGET (window));
|
|
|
8f91ed |
- gdk_window_get_position (gdkwindow, &x, &y);
|
|
|
8f91ed |
- width = gdk_window_get_width (gdkwindow);
|
|
|
8f91ed |
- height = gdk_window_get_height (gdkwindow);
|
|
|
8f91ed |
- gedit_utils_get_current_viewport (screen, &vp_x, &vp_y);
|
|
|
8f91ed |
- x += vp_x;
|
|
|
8f91ed |
- y += vp_y;
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- sc_width = gdk_screen_get_width (screen);
|
|
|
8f91ed |
- sc_height = gdk_screen_get_height (screen);
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- return x + width * .25 >= viewport_x &&
|
|
|
8f91ed |
- x + width * .75 <= viewport_x + sc_width &&
|
|
|
8f91ed |
- y >= viewport_y &&
|
|
|
8f91ed |
- y + height <= viewport_y + sc_height;
|
|
|
8f91ed |
-}
|
|
|
8f91ed |
-
|
|
|
8f91ed |
-static GeditWindow *
|
|
|
8f91ed |
-get_active_window (GtkApplication *app)
|
|
|
8f91ed |
-{
|
|
|
8f91ed |
- GdkScreen *screen;
|
|
|
8f91ed |
- guint workspace;
|
|
|
8f91ed |
- gint viewport_x, viewport_y;
|
|
|
8f91ed |
- GList *windows, *l;
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- screen = gdk_screen_get_default ();
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- workspace = gedit_utils_get_current_workspace (screen);
|
|
|
8f91ed |
- gedit_utils_get_current_viewport (screen, &viewport_x, &viewport_y);
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- /* Gtk documentation says the window list is always in MRU order */
|
|
|
8f91ed |
- windows = gtk_application_get_windows (app);
|
|
|
8f91ed |
- for (l = windows; l != NULL; l = l->next)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- GtkWindow *window = l->data;
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (GEDIT_IS_WINDOW (window) && is_in_viewport (window, screen, workspace, viewport_x, viewport_y))
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- return GEDIT_WINDOW (window);
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- return NULL;
|
|
|
8f91ed |
-}
|
|
|
8f91ed |
-
|
|
|
8f91ed |
-static void
|
|
|
8f91ed |
-set_command_line_wait (GeditApp *app,
|
|
|
8f91ed |
- GeditTab *tab)
|
|
|
8f91ed |
-{
|
|
|
8f91ed |
- g_object_set_data_full (G_OBJECT (tab),
|
|
|
8f91ed |
- "GeditTabCommandLineWait",
|
|
|
8f91ed |
- g_object_ref (app->priv->command_line),
|
|
|
8f91ed |
- (GDestroyNotify)g_object_unref);
|
|
|
8f91ed |
-}
|
|
|
8f91ed |
-
|
|
|
8f91ed |
-static void
|
|
|
8f91ed |
-open_files (GApplication *application,
|
|
|
8f91ed |
- gboolean new_window,
|
|
|
8f91ed |
- gboolean new_document,
|
|
|
8f91ed |
- gchar *geometry,
|
|
|
8f91ed |
- gint line_position,
|
|
|
8f91ed |
- gint column_position,
|
|
|
8f91ed |
- const GtkSourceEncoding *encoding,
|
|
|
8f91ed |
- GInputStream *stdin_stream,
|
|
|
8f91ed |
- GSList *file_list,
|
|
|
8f91ed |
- GApplicationCommandLine *command_line)
|
|
|
8f91ed |
-{
|
|
|
8f91ed |
- GeditWindow *window = NULL;
|
|
|
8f91ed |
- GeditTab *tab;
|
|
|
8f91ed |
- gboolean doc_created = FALSE;
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (!new_window)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- window = get_active_window (GTK_APPLICATION (application));
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (window == NULL)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- gedit_debug_message (DEBUG_APP, "Create main window");
|
|
|
8f91ed |
- window = gedit_app_create_window (GEDIT_APP (application), NULL);
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- gedit_debug_message (DEBUG_APP, "Show window");
|
|
|
8f91ed |
- gtk_widget_show (GTK_WIDGET (window));
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (geometry)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- gtk_window_parse_geometry (GTK_WINDOW (window), geometry);
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (stdin_stream)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- gedit_debug_message (DEBUG_APP, "Load stdin");
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- tab = gedit_window_create_tab_from_stream (window,
|
|
|
8f91ed |
- stdin_stream,
|
|
|
8f91ed |
- encoding,
|
|
|
8f91ed |
- line_position,
|
|
|
8f91ed |
- column_position,
|
|
|
8f91ed |
- TRUE);
|
|
|
8f91ed |
- doc_created = tab != NULL;
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (doc_created && command_line)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- set_command_line_wait (GEDIT_APP (application),
|
|
|
8f91ed |
- tab);
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
- g_input_stream_close (stdin_stream, NULL, NULL);
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (file_list != NULL)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- GSList *loaded;
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- gedit_debug_message (DEBUG_APP, "Load files");
|
|
|
8f91ed |
- loaded = _gedit_cmd_load_files_from_prompt (window,
|
|
|
8f91ed |
- file_list,
|
|
|
8f91ed |
- encoding,
|
|
|
8f91ed |
- line_position,
|
|
|
8f91ed |
- column_position);
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- doc_created = doc_created || loaded != NULL;
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (command_line)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- g_slist_foreach (loaded, (GFunc)set_command_line_wait, NULL);
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
- g_slist_free (loaded);
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (!doc_created || new_document)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- gedit_debug_message (DEBUG_APP, "Create tab");
|
|
|
8f91ed |
- tab = gedit_window_create_tab (window, TRUE);
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- if (command_line)
|
|
|
8f91ed |
- {
|
|
|
8f91ed |
- set_command_line_wait (GEDIT_APP (application),
|
|
|
8f91ed |
- tab);
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
- }
|
|
|
8f91ed |
-
|
|
|
8f91ed |
- gtk_window_present (GTK_WINDOW (window));
|
|
|
8f91ed |
-}
|
|
|
8f91ed |
-
|
|
|
8f91ed |
static void
|
|
|
8f91ed |
gedit_app_activate (GApplication *application)
|
|
|
8f91ed |
{
|