Commit c2670d51 authored by Ignacio Casal Quinteiro's avatar Ignacio Casal Quinteiro
Browse files

Do not show the notebook border when the window is maximized.

parent e4053c88
......@@ -858,6 +858,22 @@ gedit_multi_notebook_next_notebook (GeditMultiNotebook *mnb)
gtk_widget_grab_focus (notebook);
}
void
gedit_multi_notebook_collapse_notebook_border (GeditMultiNotebook *mnb,
gboolean collapse)
{
GList *l;
g_return_if_fail (GEDIT_IS_MULTI_NOTEBOOK (mnb));
for (l = mnb->priv->notebooks; l != NULL; l = g_list_next (l))
{
GeditNotebook *notebook = GEDIT_NOTEBOOK (l->data);
gedit_notebook_collapse_border (notebook, collapse);
}
}
void
gedit_multi_notebook_foreach_notebook (GeditMultiNotebook *mnb,
GtkCallback callback,
......
......@@ -121,6 +121,9 @@ void gedit_multi_notebook_remove_active_notebook (GeditMultiNotebook *mnb);
void gedit_multi_notebook_previous_notebook (GeditMultiNotebook *mnb);
void gedit_multi_notebook_next_notebook (GeditMultiNotebook *mnb);
void gedit_multi_notebook_collapse_notebook_border (GeditMultiNotebook *mnb,
gboolean collapse);
void gedit_multi_notebook_foreach_notebook (GeditMultiNotebook *mnb,
GtkCallback callback,
gpointer callback_data);
......
......@@ -68,10 +68,13 @@ struct _GeditNotebookPrivate
GeditNotebookShowTabsModeType show_tabs_mode;
gint xthickness;
guint drag_in_progress : 1;
guint close_buttons_sensitive : 1;
guint tab_drag_and_drop_enabled : 1;
guint destroy_has_run : 1;
guint collapse_border : 1;
};
G_DEFINE_TYPE(GeditNotebook, gedit_notebook, GTK_TYPE_NOTEBOOK)
......@@ -215,6 +218,20 @@ gedit_notebook_grab_focus (GtkWidget *widget)
gtk_widget_grab_focus (tab);
}
static void
gedit_notebook_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
GeditNotebook *nb = GEDIT_NOTEBOOK (widget);
if (previous_style != NULL && nb->priv->collapse_border)
{
previous_style->xthickness = 0;
}
GTK_WIDGET_CLASS (gedit_notebook_parent_class)->style_set (widget, previous_style);
}
static void
gedit_notebook_class_init (GeditNotebookClass *klass)
{
......@@ -228,7 +245,8 @@ gedit_notebook_class_init (GeditNotebookClass *klass)
object_class->set_property = gedit_notebook_set_property;
gtkwidget_class->grab_focus = gedit_notebook_grab_focus;
gtkwidget_class->style_set = gedit_notebook_style_set;
notebook_class->change_current_page = gedit_notebook_change_current_page;
g_object_class_install_property (object_class, PROP_SHOW_TABS_MODE,
......@@ -787,6 +805,7 @@ gedit_notebook_init (GeditNotebook *notebook)
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE);
gtk_container_set_border_width (GTK_CONTAINER (notebook), 0);
g_settings_bind (notebook->priv->ui_settings,
GEDIT_SETTINGS_SHOW_TABS_MODE,
......@@ -1138,4 +1157,34 @@ gedit_notebook_get_tab_drag_and_drop_enabled (GeditNotebook *nb)
return nb->priv->tab_drag_and_drop_enabled;
}
void
gedit_notebook_collapse_border (GeditNotebook *nb,
gboolean collapse)
{
GtkRcStyle *rcstyle;
gint xthickness;
g_return_if_fail (GEDIT_IS_NOTEBOOK (nb));
nb->priv->collapse_border = collapse;
if (collapse)
{
GtkStyle *style;
style = gtk_widget_get_style (GTK_WIDGET (nb));
nb->priv->xthickness = style->xthickness;
xthickness = 0;
}
else
{
xthickness = nb->priv->xthickness;
}
rcstyle = gtk_rc_style_new ();
rcstyle->xthickness = xthickness;
gtk_widget_modify_style (GTK_WIDGET (nb), rcstyle);
g_object_unref (rcstyle);
}
/* ex:ts=8:noet: */
......@@ -134,6 +134,9 @@ void gedit_notebook_set_tab_drag_and_drop_enabled
gboolean gedit_notebook_get_tab_drag_and_drop_enabled
(GeditNotebook *nb);
void gedit_notebook_collapse_border (GeditNotebook *nb,
gboolean collapse);
G_END_DECLS
#endif /* GEDIT_NOTEBOOK_H */
......
......@@ -385,6 +385,9 @@ gedit_window_window_state_event (GtkWidget *widget,
_gedit_statusbar_set_has_resize_grip (GEDIT_STATUSBAR (window->priv->statusbar),
show);
gedit_multi_notebook_collapse_notebook_border (window->priv->multi_notebook,
!show);
}
if (GTK_WIDGET_CLASS (gedit_window_parent_class)->window_state_event)
......
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