Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Sat, 04 Oct 2014 16:06:38 UTC Commit: aef37b05aecd85e527acd6d8c07629ab602b8b3b https://github.com/geany/geany-plugins/commit/aef37b05aecd85e527acd6d8c07629...
Log Message: ----------- gproject: Fix opening already opened files from the sidebar
Also always focus the editor window when changing a file.
Modified Paths: -------------- gproject/src/gproject-sidebar.c gproject/src/gproject-utils.c
Modified: gproject/src/gproject-sidebar.c 9 lines changed, 8 insertions(+), 1 deletions(-) =================================================================== @@ -378,8 +378,11 @@ static void on_open_clicked(void) static gboolean on_button_press(G_GNUC_UNUSED GtkWidget * widget, GdkEventButton * event, G_GNUC_UNUSED gpointer user_data) { - if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) + if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) + { on_open_clicked(); + return TRUE; + }
return FALSE; } @@ -391,7 +394,10 @@ static gboolean on_key_press(G_GNUC_UNUSED GtkWidget * widget, GdkEventKey * eve || event->keyval == GDK_ISO_Enter || event->keyval == GDK_KP_Enter || event->keyval == GDK_space) + { on_open_clicked(); + return TRUE; + } return FALSE; }
@@ -719,6 +725,7 @@ static gboolean on_button_release(G_GNUC_UNUSED GtkWidget * widget, GdkEventButt
gtk_menu_popup(GTK_MENU(s_popup_menu.widget), NULL, NULL, NULL, NULL, event->button, event->time); + return TRUE; }
return FALSE;
Modified: gproject/src/gproject-utils.c 13 lines changed, 2 insertions(+), 11 deletions(-) =================================================================== @@ -138,19 +138,10 @@ void open_file(gchar *utf8_name) doc = document_find_by_filename(utf8_name);
if (!doc) - { document_open_file(name, FALSE, NULL, NULL); - } else - { - GtkNotebook *notebook; - gint page_num; - - notebook = GTK_NOTEBOOK(geany->main_widgets->notebook); - page_num = gtk_notebook_page_num(notebook, GTK_WIDGET(doc->editor->sci)); - - gtk_notebook_set_current_page(notebook, page_num); - } + document_show_tab(doc); + document_grab_focus(doc);
g_free(name); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).