GNOME Bugzilla – Bug 673741
option --new-window not working correctly
Last modified: 2012-11-11 11:21:29 UTC
I copied the following from my Ubuntu Bug report, as I am too lazy to rewrite my entire report again: "First, to reproduce, open Gedit (Text Editor). Right click on its icon in the Unity Taskbar. Oddly, clicking either of the two new options (create a new document or open a new window) opens a new window with two tabs, labelled Untitled Document 2 and the other one Untitled Document 3. What should happen is one new tab is opened when creating a new document, and one new window with one tab is opened for opening a new window. However, the aforementioned happens. I will upload a screenshot ASAP. I am running Precise Beta with the latest updates, and the latest version of Gedit." See the following URL for my Ubuntu Launchpad Bug: https://bugs.launchpad.net/gedit/+bug/965510 I'll specify that the same happens from any shell, as using the terminal from Ubuntu causes the following to print out: "The issue is with "gedit --new-window" running it from the command line does the same it also prints those warnings" "** (gedit:17320): CRITICAL **: gedit_multi_notebook_get_active_tab: assertion `GEDIT_IS_MULTI_NOTEBOOK (mnb)' failed (gedit:17320): Gtk-CRITICAL **: gtk_action_group_get_action: assertion `GTK_IS_ACTION_GROUP (action_group)' failed (gedit:17320): Gtk-CRITICAL **: gtk_action_set_sensitive: assertion `GTK_IS_ACTION (action)' failed" -- kudos to Sebastien Bacher (seb128), he found this terminal output. In basic terms, opening a new window or opening a new document from the terminal results in two tabs titled Untitled Document 1 and Untitled Document 2 appearing. Note that one new tab should open for one with an Untitled Document x, after opening a new document, and for the new window, a new window with one tab titled Untitled Document x should pop up. Unfortunately, this does not occur. If you want a screenshot, go to the URL that I mentioned earlier.
That's still an issue in 3.4.1
*** Bug 679548 has been marked as a duplicate of this bug. ***
Those warnings seem to be thrown when closing the new window rather than on its creation so are probably unrelated to this bug.
Created attachment 228672 [details] [review] Removed unneeded call to create new tab I've attached a patch to fix this bug. There was an extra call to create a new tab that is not needed as the creation of a new window already creates a new tab.
Hi Timothy. thanks for the patch... I think the patch is probably ok (didn't have the time yet to look in detail). However as far as I recall it is not true that a new window automatically creates a new tab: for instance if you look at the non-dbus case in gedit.c, we call create_new_tab too. Can you investigate a bit where the tab is actually created? I guess when handling the command line, but it would be nice to double check, to make sure we are removing the right extra create_tab call. From a purely stylistic point of view, looking at the surrounding code I think it might make sense to change the patch to do: if (!new_window) { ... } if (|ret) { create_window() }
I discussed it with Jesse and the new tab is created when handling the command line. The patch is correct though, I slightly amended it as described above and committed it both to master and gnome-3-6. Thank you!
Yep was just about about to create a new patch and reply when I noticed the commit. Yeah the tab is created in gedit-dbus.c in dbus_handle_open ... else if (loaded_documents == NULL) { GeditTab *tab; tab = gedit_window_create_tab (window, TRUE); jump_to = TRUE; loaded_documents = g_slist_append (loaded_documents, gedit_tab_get_document (tab)); } ...