[gedit] Do not show the notebook border when the window is maximized.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Do not show the notebook border when the window is maximized.
- Date: Sat, 24 Jul 2010 09:45:19 +0000 (UTC)
commit c2670d51a5e00b35697e5353738830790fcf18f1
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Fri Jul 23 20:12:50 2010 +0200
Do not show the notebook border when the window is maximized.
gedit/gedit-multi-notebook.c | 16 +++++++++++++
gedit/gedit-multi-notebook.h | 3 ++
gedit/gedit-notebook.c | 51 +++++++++++++++++++++++++++++++++++++++++-
gedit/gedit-notebook.h | 3 ++
gedit/gedit-window.c | 3 ++
5 files changed, 75 insertions(+), 1 deletions(-)
---
diff --git a/gedit/gedit-multi-notebook.c b/gedit/gedit-multi-notebook.c
index 9dff862..6a83ad9 100644
--- a/gedit/gedit-multi-notebook.c
+++ b/gedit/gedit-multi-notebook.c
@@ -859,6 +859,22 @@ gedit_multi_notebook_next_notebook (GeditMultiNotebook *mnb)
}
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,
gpointer callback_data)
diff --git a/gedit/gedit-multi-notebook.h b/gedit/gedit-multi-notebook.h
index ee32c5a..2304a48 100644
--- a/gedit/gedit-multi-notebook.h
+++ b/gedit/gedit-multi-notebook.h
@@ -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);
diff --git a/gedit/gedit-notebook.c b/gedit/gedit-notebook.c
index fb6221f..d8517ce 100644
--- a/gedit/gedit-notebook.c
+++ b/gedit/gedit-notebook.c
@@ -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)
@@ -216,6 +219,20 @@ gedit_notebook_grab_focus (GtkWidget *widget)
}
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)
{
GObjectClass *object_class = G_OBJECT_CLASS (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: */
diff --git a/gedit/gedit-notebook.h b/gedit/gedit-notebook.h
index 89b91ad..79a2215 100644
--- a/gedit/gedit-notebook.h
+++ b/gedit/gedit-notebook.h
@@ -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 */
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index f7632fd..5eff0cc 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]