Commit 28f67de1 authored by Jonh Wendell's avatar Jonh Wendell Committed by Jonh Wendell S. Santana
Browse files

Closes #518351 – Don't show tabs when only one connection is open.

2008-05-06  Jonh Wendell <jwendell@gnome.org>

	* lots of files: Closes #518351 – Don't show tabs when only one connection is open.

svn path=/trunk/; revision=322
parent f167fa5e
2008-05-06 Jonh Wendell <jwendell@gnome.org>
* lots of files: Closes #518351 – Don't show tabs when only one connection is open.
2008-05-06 Jonh Wendell <jwendell@gnome.org>
* lots of files: Make VinagrePrefs a GObject
......
......@@ -54,7 +54,7 @@
<applyto>/apps/vinagre/always_show_tabs</applyto>
<owner>vinagre</owner>
<type>bool</type>
<default>true</default>
<default>false</default>
<locale name="C">
<short>Whether we should show tabs even when there is only one active connection</short>
<long>Set to "true" to always show the tabs. Setting to "false" will only show the tabs when there are more than one active connection.</long>
......
......@@ -28,6 +28,7 @@
#include "vinagre-notebook.h"
#include "vinagre-utils.h"
#include "vinagre-prefs.h"
#define VINAGRE_NOTEBOOK_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), VINAGRE_TYPE_NOTEBOOK, VinagreNotebookPrivate))
......@@ -55,13 +56,41 @@ vinagre_notebook_new (VinagreWindow *window)
return GTK_WIDGET (nb);
}
void
vinagre_notebook_show_hide_tabs (VinagreNotebook *nb)
{
gboolean always;
gint n;
n = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb));
g_object_get (vinagre_prefs_get_default (),
"always-show-tabs", &always,
NULL);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb),
(n > 1) || (always));
}
static void
vinagre_notebook_init (VinagreNotebook *notebook)
{
notebook->priv = VINAGRE_NOTEBOOK_GET_PRIVATE (notebook);
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE);
g_signal_connect (notebook,
"page-added",
G_CALLBACK (vinagre_notebook_show_hide_tabs),
NULL);
g_signal_connect (notebook,
"page-removed",
G_CALLBACK (vinagre_notebook_show_hide_tabs),
NULL);
g_signal_connect_swapped (vinagre_prefs_get_default (),
"notify::always-show-tabs",
G_CALLBACK (vinagre_notebook_show_hide_tabs),
notebook);
}
static void
......
......@@ -93,6 +93,7 @@ void vinagre_notebook_remove_tab (VinagreNotebook *nb,
void vinagre_notebook_remove_all_tabs (VinagreNotebook *nb);
void vinagre_notebook_show_hide_tabs (VinagreNotebook *nb);
G_END_DECLS
#endif /* __VINAGRE_NOTEBOOK_H__ */
......
......@@ -230,7 +230,7 @@ vinagre_prefs_get_property (GObject *object, guint prop_id, GValue *value, GPara
g_value_set_boolean (value, vinagre_prefs_get_bool (prefs, VM_SHARED_FLAG, TRUE));
break;
case PROP_ALWAYS_SHOW_TABS:
g_value_set_boolean (value, vinagre_prefs_get_bool (prefs, VM_ALWAYS_SHOW_TABS, TRUE));
g_value_set_boolean (value, vinagre_prefs_get_bool (prefs, VM_ALWAYS_SHOW_TABS, FALSE));
break;
case PROP_TOOLBAR_VISIBLE:
g_value_set_boolean (value, vinagre_prefs_get_bool (prefs, VM_TOOLBAR_VISIBLE, TRUE));
......@@ -283,7 +283,7 @@ vinagre_prefs_class_init (VinagrePrefsClass *klass)
g_param_spec_boolean ("always-show-tabs",
"Always show tabs",
"Whether we should show the tabs even when there is ony one active connection",
TRUE,
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_TOOLBAR_VISIBLE,
......
......@@ -112,6 +112,7 @@ vinagre_tab_window_state_cb (GtkWidget *widget,
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (tab->priv->scroll),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
vinagre_notebook_show_hide_tabs (tab->priv->nb);
}
return FALSE;
......
......@@ -124,7 +124,7 @@ vinagre_window_show_hide_controls (VinagreWindow *window)
if (window->priv->statusbar_visible)
gtk_widget_show_all (window->priv->statusbar);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (window->priv->notebook), TRUE);
vinagre_notebook_show_hide_tabs (VINAGRE_NOTEBOOK (window->priv->notebook));
gtk_notebook_set_show_border (GTK_NOTEBOOK (window->priv->notebook), TRUE);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment