Revision: 5448 http://geany.svn.sourceforge.net/geany/?rev=5448&view=rev Author: ntrel Date: 2010-11-29 13:21:35 +0000 (Mon, 29 Nov 2010)
Log Message: ----------- Add 'Open in New Window' command in the notebook tab menu (based on patch by Matthew Brush, thanks - #3118059).
Modified Paths: -------------- branches/unstable/ChangeLog branches/unstable/src/notebook.c
Modified: branches/unstable/ChangeLog =================================================================== --- branches/unstable/ChangeLog 2010-11-29 12:48:33 UTC (rev 5447) +++ branches/unstable/ChangeLog 2010-11-29 13:21:35 UTC (rev 5448) @@ -1,3 +1,10 @@ +2010-11-29 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/notebook.c: + Add 'Open in New Window' command in the notebook tab menu (based on + patch by Matthew Brush, thanks - #3118059). + + 2010-11-28 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* data/filetypes.cpp, data/filetypes.vala, data/filetypes.glsl,
Modified: branches/unstable/src/notebook.c =================================================================== --- branches/unstable/src/notebook.c 2010-11-29 12:48:33 UTC (rev 5447) +++ branches/unstable/src/notebook.c 2010-11-29 13:21:35 UTC (rev 5448) @@ -193,10 +193,39 @@ }
+static void on_open_in_new_window_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + gchar *geany_path; + GeanyDocument *doc = user_data; + + g_return_if_fail(doc->is_valid); + + geany_path = g_find_program_in_path("geany"); + + if (geany_path) + { + gchar *doc_path = utils_get_locale_from_utf8(doc->file_name); + gchar *argv[] = {geany_path, "-i", doc_path, NULL}; + GError *err = NULL; + + if (!utils_spawn_async(NULL, argv, NULL, 0, NULL, NULL, NULL, &err)) + { + g_printerr("Unable to open new window: %s", err->message); + g_error_free(err); + } + g_free(doc_path); + g_free(geany_path); + } + else + g_printerr("Unable to find 'geany'"); +} + + static void show_tab_bar_popup_menu(GdkEventButton *event) { GtkWidget *menu_item; static GtkWidget *menu = NULL; + GeanyDocument *doc = NULL;
if (menu == NULL) menu = gtk_menu_new(); @@ -211,6 +240,20 @@ gtk_widget_show(menu_item); gtk_container_add(GTK_CONTAINER(menu), menu_item);
+ doc = document_get_current(); + menu_item = ui_image_menu_item_new(GTK_STOCK_OPEN, "Open in New _Window"); + gtk_widget_show(menu_item); + gtk_container_add(GTK_CONTAINER(menu), menu_item); + g_signal_connect(menu_item, "activate", + G_CALLBACK(on_open_in_new_window_activate), doc); + /* disable if not on disk */ + if (!doc->real_path) + gtk_widget_set_sensitive(menu_item, FALSE); + + menu_item = gtk_separator_menu_item_new(); + gtk_widget_show(menu_item); + gtk_container_add(GTK_CONTAINER(menu), menu_item); + menu_item = ui_image_menu_item_new(GTK_STOCK_CLOSE, _("Close Ot_her Documents")); gtk_widget_show(menu_item); gtk_container_add(GTK_CONTAINER(menu), menu_item);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.