Revision: 2042 http://geany.svn.sourceforge.net/geany/?rev=2042&view=rev Author: eht16 Date: 2007-11-11 02:19:50 -0800 (Sun, 11 Nov 2007)
Log Message: ----------- Enable close tab on middle-clicking a notebook tab label. Enable toggle additional widgets on double-clicking notebook tab label.
Modified Paths: -------------- trunk/ChangeLog trunk/src/notebook.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-11-11 09:09:47 UTC (rev 2041) +++ trunk/ChangeLog 2007-11-11 10:19:50 UTC (rev 2042) @@ -5,6 +5,10 @@ utils_get_date_time(). * src/main.c: Don't compile plugin command line option when plugin support is disabled. + * src/notebook.c: + Enable close tab on middle-clicking a notebook tab label. + Enable toggle additional widgets on double-clicking notebook tab + label.
2007-11-08 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/notebook.c =================================================================== --- trunk/src/notebook.c 2007-11-11 09:09:47 UTC (rev 2041) +++ trunk/src/notebook.c 2007-11-11 10:19:50 UTC (rev 2042) @@ -32,6 +32,7 @@ #include "ui_utils.h" #include "treeviews.h" #include "support.h" +#include "callbacks.h"
#define GEANY_DND_NOTEBOOK_TAB_TYPE "geany_dnd_notebook_tab"
@@ -300,11 +301,23 @@ } }
+gboolean notebook_tab_label_cb(GtkWidget *widget, GdkEventButton *event, gpointer user_data) +{ + // toggle additional widgets on double click + if (event->type == GDK_2BUTTON_PRESS) + on_menu_toggle_all_additional_widgets1_activate(NULL, NULL); + // close tab on middle click + if (event->button == 2) + document_remove(gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook), GTK_WIDGET(user_data)));
+ return FALSE; +} + + /* Returns page number of notebook page, or -1 on error */ gint notebook_new_tab(gint doc_idx) { - GtkWidget *hbox; + GtkWidget *hbox, *ebox; gint tabnum; gchar *title; document *this = &(doc_list[doc_idx]); @@ -317,8 +330,14 @@
this->tab_label = gtk_label_new(title);
+ ebox = gtk_event_box_new(); + GTK_WIDGET_SET_FLAGS(ebox, GTK_NO_WINDOW); + g_signal_connect(G_OBJECT(ebox), "button-press-event", + G_CALLBACK(notebook_tab_label_cb), page); + hbox = gtk_hbox_new(FALSE, 2); - gtk_box_pack_start(GTK_BOX(hbox), this->tab_label, FALSE, FALSE, 0); + gtk_container_add(GTK_CONTAINER(ebox), this->tab_label); + gtk_box_pack_start(GTK_BOX(hbox), ebox, FALSE, FALSE, 0);
if (prefs.show_tab_cross) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.