SF.net SVN: geany:[4839] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Mon Apr 19 20:42:34 UTC 2010
Revision: 4839
http://geany.svn.sourceforge.net/geany/?rev=4839&view=rev
Author: eht16
Date: 2010-04-19 20:42:34 +0000 (Mon, 19 Apr 2010)
Log Message:
-----------
Automatically show and hide the sidebar notebook tabs according to the amount of visible pages (patch by Adrian Dimitrov, thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/sidebar.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-04-19 20:42:23 UTC (rev 4838)
+++ trunk/ChangeLog 2010-04-19 20:42:34 UTC (rev 4839)
@@ -3,6 +3,9 @@
* tagmanager/pascal.c:
More fixes to prevent possible crashes by trying to free NULL
pointers.
+ * src/sidebar.c:
+ Automatically show and hide the sidebar notebook tabs according
+ to the amount of visible pages (patch by Adrian Dimitrov, thanks).
2010-04-19 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/sidebar.c
===================================================================
--- trunk/src/sidebar.c 2010-04-19 20:42:23 UTC (rev 4838)
+++ trunk/src/sidebar.c 2010-04-19 20:42:34 UTC (rev 4839)
@@ -105,6 +105,8 @@
static void on_list_document_activate(GtkCheckMenuItem *item, gpointer user_data);
static void on_list_symbol_activate(GtkCheckMenuItem *item, gpointer user_data);
static void documents_menu_update(GtkTreeSelection *selection);
+static void sidebar_tabs_show_hide(GtkNotebook *notebook, GtkWidget *child,
+ guint page_num, gpointer data);
/* the prepare_* functions are document-related, but I think they fit better here than in document.c */
@@ -550,6 +552,7 @@
{
interface_prefs.sidebar_openfiles_visible = gtk_check_menu_item_get_active(item);
ui_sidebar_show_hide();
+ sidebar_tabs_show_hide(GTK_NOTEBOOK(main_widgets.sidebar_notebook), NULL, 0, NULL);
}
@@ -557,6 +560,7 @@
{
interface_prefs.sidebar_symbol_visible = gtk_check_menu_item_get_active(item);
ui_sidebar_show_hide();
+ sidebar_tabs_show_hide(GTK_NOTEBOOK(main_widgets.sidebar_notebook), NULL, 0, NULL);
}
@@ -902,12 +906,14 @@
prepare_openfiles();
/* note: ui_prefs.sidebar_page is reapplied after plugins are loaded */
stash_group_display(stash_group, NULL);
+ sidebar_tabs_show_hide(GTK_NOTEBOOK(main_widgets.sidebar_notebook), NULL, 0, NULL);
}
static void on_save_settings(void)
{
stash_group_update(stash_group, NULL);
+ sidebar_tabs_show_hide(GTK_NOTEBOOK(main_widgets.sidebar_notebook), NULL, 0, NULL);
}
@@ -925,9 +931,19 @@
/* delay building documents treeview until sidebar font has been read */
g_signal_connect(geany_object, "load-settings", on_load_settings, NULL);
g_signal_connect(geany_object, "save-settings", on_save_settings, NULL);
+
+
+ if (gtk_check_version(2, 10, 0) == NULL)
+ {
+ g_signal_connect(main_widgets.sidebar_notebook, "page-added",
+ G_CALLBACK(sidebar_tabs_show_hide), NULL);
+
+ g_signal_connect(main_widgets.sidebar_notebook, "page-removed",
+ G_CALLBACK(sidebar_tabs_show_hide), NULL);
+ }
+ sidebar_tabs_show_hide(GTK_NOTEBOOK(main_widgets.sidebar_notebook), NULL, 0, NULL);
}
-
#define WIDGET(w) w && GTK_IS_WIDGET(w)
void sidebar_finalize(void)
@@ -968,3 +984,16 @@
}
}
+
+static void sidebar_tabs_show_hide(GtkNotebook *notebook, GtkWidget *child,
+ guint page_num, gpointer data)
+{
+ gint tabs = gtk_notebook_get_n_pages(notebook);
+
+ if (interface_prefs.sidebar_symbol_visible == FALSE)
+ tabs--;
+ if (interface_prefs.sidebar_openfiles_visible == FALSE)
+ tabs--;
+
+ gtk_notebook_set_show_tabs(notebook, (tabs > 1));
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list