[gedit] Remove key to set a specific toolbar style.



commit 0ac5cafb369bf289ee93f64adefaeced70c5b73a
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sun Oct 10 11:33:33 2010 +0200

    Remove key to set a specific toolbar style.
    
    This key was there from the times we had an ui for it.
    Now we just use the system setting to set the style for the toolbar.

 configure.ac                           |    5 --
 data/org.gnome.gedit.gschema.xml.in.in |   11 ----
 gedit/gedit-settings.h                 |    7 ---
 gedit/gedit-window-private.h           |    1 -
 gedit/gedit-window.c                   |   91 ++++++++------------------------
 5 files changed, 22 insertions(+), 93 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index dceb02c..740c2f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,16 +54,11 @@ dnl active plugins for gedit.schemas
 ACTIVE_PLUGINS="'docinfo', 'modelines', 'filebrowser', 'spell', 'time'"
 AC_SUBST(ACTIVE_PLUGINS)
 
-dnl toolbar style for gedit schemas
-TOOLBAR_STYLE="system"
-AC_SUBST(TOOLBAR_STYLE)
-
 dnl check for win32 platform
 AC_MSG_CHECKING([for Win32 platform])
 case "$host" in
   *-*-mingw*|*-*-cygwin*)
     platform_win32=yes
-    TOOLBAR_STYLE="icons"
     ;;
   *)
     platform_win32=no
diff --git a/data/org.gnome.gedit.gschema.xml.in.in b/data/org.gnome.gedit.gschema.xml.in.in
index dc238d8..1f331b9 100644
--- a/data/org.gnome.gedit.gschema.xml.in.in
+++ b/data/org.gnome.gedit.gschema.xml.in.in
@@ -153,17 +153,6 @@
       <_summary>Toolbar is Visible</_summary>
       <_description>Whether the toolbar should be visible in editing windows.</_description>
     </key>
-    <key name="toolbar-buttons-style" enum="org.gnome.gedit.GeditToolbarSetting">
-      <aliases>
-        <alias value='GEDIT_TOOLBAR_SYSTEM' target='system'/>
-        <alias value='GEDIT_TOOLBAR_ICONS' target='icons'/>
-        <alias value='GEDIT_TOOLBAR_ICONS_AND_TEXT' target='icons-and-text'/>
-        <alias value='GEDIT_TOOLBAR_ICONS_BOTH_HORIZ' target='icons-both-horiz'/>
-      </aliases>
-      <default>'@TOOLBAR_STYLE@'</default>
-      <_summary>Toolbar Buttons Style</_summary>
-      <_description>Style for the toolbar buttons. Possible values are "system" to use the system's default style, "icons" to display icons only, "icons-and-text" to display both icons and text, and "icons-both-horiz" to display prioritized text beside icons. Note that the values are case-sensitive, so make sure they appear exactly as mentioned here.</_description>
-    </key>
     <key name="notebook-show-tabs-mode" enum="org.gnome.gedit.GeditNotebookShowTabsModeType">
       <default>'always'</default>
       <_summary>Notebook Show Tabs Mode</_summary>
diff --git a/gedit/gedit-settings.h b/gedit/gedit-settings.h
index e18ad15..1015370 100644
--- a/gedit/gedit-settings.h
+++ b/gedit/gedit-settings.h
@@ -55,13 +55,6 @@ struct _GeditSettingsClass
 	GObjectClass parent_class;
 };
 
-typedef enum {
-	GEDIT_TOOLBAR_SYSTEM = 0,
-	GEDIT_TOOLBAR_ICONS,
-	GEDIT_TOOLBAR_ICONS_AND_TEXT,
-	GEDIT_TOOLBAR_ICONS_BOTH_HORIZ
-} GeditToolbarSetting;
-
 GType			 gedit_settings_get_type			(void) G_GNUC_CONST;
 
 GObject			*gedit_settings_new				(void);
diff --git a/gedit/gedit-window-private.h b/gedit/gedit-window-private.h
index 4b365e9..d6f27d5 100644
--- a/gedit/gedit-window-private.h
+++ b/gedit/gedit-window-private.h
@@ -95,7 +95,6 @@ struct _GeditWindowPrivate
 	GtkWidget      *toolbar;
 	GtkWidget      *toolbar_recent_menu;
 	GtkWidget      *menubar;
-	GeditToolbarSetting toolbar_style;
 
 	/* recent files */
 	GtkActionGroup *recents_action_group;
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index ad78806..81800fe 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -590,90 +590,35 @@ disconnect_proxy_cb (GtkUIManager *manager,
 	}
 }
 
-static void
-apply_toolbar_style (GeditWindow *window,
-		     GtkWidget *toolbar)
-{
-	switch (window->priv->toolbar_style)
-	{
-		case GEDIT_TOOLBAR_SYSTEM:
-			gedit_debug_message (DEBUG_WINDOW, "GEDIT: SYSTEM");
-			gtk_toolbar_unset_style (
-					GTK_TOOLBAR (toolbar));
-			break;
-
-		case GEDIT_TOOLBAR_ICONS:
-			gedit_debug_message (DEBUG_WINDOW, "GEDIT: ICONS");
-			gtk_toolbar_set_style (
-					GTK_TOOLBAR (toolbar),
-					GTK_TOOLBAR_ICONS);
-			break;
-
-		case GEDIT_TOOLBAR_ICONS_AND_TEXT:
-			gedit_debug_message (DEBUG_WINDOW, "GEDIT: ICONS_AND_TEXT");
-			gtk_toolbar_set_style (
-					GTK_TOOLBAR (toolbar),
-					GTK_TOOLBAR_BOTH);
-			break;
-
-		case GEDIT_TOOLBAR_ICONS_BOTH_HORIZ:
-			gedit_debug_message (DEBUG_WINDOW, "GEDIT: ICONS_BOTH_HORIZ");
-			gtk_toolbar_set_style (
-					GTK_TOOLBAR (toolbar),
-					GTK_TOOLBAR_BOTH_HORIZ);
-			break;
-
-		default:
-			g_assert_not_reached ();
-			break;
-	}
-}
-
 /* Returns TRUE if toolbar is visible */
 static gboolean
-set_toolbar_style (GeditWindow *window,
-		   GeditWindow *origin)
+set_toolbar_visibility (GeditWindow *window,
+                        GeditWindow *origin)
 {
 	gboolean visible;
-	GeditToolbarSetting style;
 	GtkAction *action;
-	gboolean toolbar_visible;
-
-	toolbar_visible = g_settings_get_boolean (window->priv->ui_settings,
-						  GEDIT_SETTINGS_TOOLBAR_VISIBLE);
 
 	if (origin == NULL)
-		visible = toolbar_visible;
+	{
+		visible = g_settings_get_boolean (window->priv->ui_settings,
+		                                  GEDIT_SETTINGS_TOOLBAR_VISIBLE);
+	}
 	else
+	{
 		visible = gtk_widget_get_visible (origin->priv->toolbar);
-	
+	}
+
 	/* Set visibility */
 	gtk_widget_set_visible (window->priv->toolbar, visible);
 
 	action = gtk_action_group_get_action (window->priv->always_sensitive_action_group,
-					      "ViewToolbar");
+	                                      "ViewToolbar");
 
 	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) != visible)
-		gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible);
-
-	/* Set style */
-	if (origin == NULL)
-	{
-		GObject *settings;
-
-		settings = _gedit_app_get_settings (gedit_app_get_default ());
-		style = g_settings_get_enum (window->priv->ui_settings,
-					     GEDIT_SETTINGS_TOOLBAR_BUTTONS_STYLE);
-	}
-	else
 	{
-		style = origin->priv->toolbar_style;
+		gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible);
 	}
-	
-	window->priv->toolbar_style = style;
-	
-	apply_toolbar_style (window, window->priv->toolbar);
-	
+
 	return visible;
 }
 
@@ -1751,7 +1696,15 @@ create_menu_bar_and_toolbar (GeditWindow *window,
 			    FALSE,
 			    0);
 
-	set_toolbar_style (window, NULL);
+	/* XXX: We shouldn't need this special case, gtk+ should take care of
+	        using this setting when it is in windows */
+#ifdef G_OS_WIN32
+	gtk_toolbar_set_style (GTK_TOOLBAR (window->priv->toolbar),
+	                       GTK_TOOLBAR_ICONS);
+#else
+	gtk_toolbar_unset_style (GTK_TOOLBAR (window->priv->toolbar));
+#endif
+	set_toolbar_visibility (window, NULL);
 	
 	window->priv->toolbar_recent_menu = setup_toolbar_open_button (window,
 								       window->priv->toolbar);
@@ -2286,7 +2239,7 @@ clone_window (GeditWindow *origin)
 	                        gtk_widget_get_visible (origin->priv->bottom_panel));
 
 	set_statusbar_style (window, origin);
-	set_toolbar_style (window, origin);
+	set_toolbar_visibility (window, origin);
 
 	return window;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]