After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 673741 - option --new-window not working correctly
option --new-window not working correctly
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2012-04-08 15:00 UTC by Michael Loney
Modified: 2012-11-11 11:21 UTC
See Also:
GNOME target: ---
GNOME version: 3.3/3.4


Attachments
Removed unneeded call to create new tab (762 bytes, patch)
2012-11-11 02:15 UTC, Timothy Arceri
none Details | Review

Description Michael Loney 2012-04-08 15:00:16 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.
Comment 1 Sebastien Bacher 2012-04-17 08:39:38 UTC
That's still an issue in 3.4.1
Comment 2 Nathan Williams 2012-07-07 10:09:45 UTC
*** Bug 679548 has been marked as a duplicate of this bug. ***
Comment 3 Timothy Arceri 2012-11-10 12:00:14 UTC
Those warnings seem to be thrown when closing the new window rather than on its creation so are probably unrelated to this bug.
Comment 4 Timothy Arceri 2012-11-11 02:15:43 UTC
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.
Comment 5 Paolo Borelli 2012-11-11 09:42:23 UTC
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()
}
Comment 6 Paolo Borelli 2012-11-11 10:22:39 UTC
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!
Comment 7 Timothy Arceri 2012-11-11 11:21:29 UTC
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));
	}
...