[xchat-gnome] Bug 524030 - provide option to hide statusbar



commit 659f3a7d7e6392155d409e067a2da0e589c968d8
Author: Ritesh Khadgaray <khadgaray gmail com>
Date:   Wed Sep 16 16:49:09 2009 +0530

    Bug 524030 -  provide option to hide statusbar

 data/xchat-gnome-ui.xml            |    1 +
 src/fe-gnome/apps_xchat.schemas.in |   11 ++++++++++
 src/fe-gnome/main-window.c         |   37 ++++++++++++++++++++++++++++-------
 3 files changed, 41 insertions(+), 8 deletions(-)
---
diff --git a/data/xchat-gnome-ui.xml b/data/xchat-gnome-ui.xml
index 68531d8..22afabf 100644
--- a/data/xchat-gnome-ui.xml
+++ b/data/xchat-gnome-ui.xml
@@ -46,6 +46,7 @@
 			<menuitem name="ViewNextDiscussion" action="ViewNextDiscussion"/>
 			<separator name="ViewSep1"/>
 			<menuitem name="ViewShowSidebar" action="ViewShowSidebar"/>
+			<menuitem name="ViewShowStatusbar" action="ViewStatusbar"/>
 		</menu>
 
 		<menu name="HelpMenu" action="Help">
diff --git a/src/fe-gnome/apps_xchat.schemas.in b/src/fe-gnome/apps_xchat.schemas.in
index 90846ea..3147664 100644
--- a/src/fe-gnome/apps_xchat.schemas.in
+++ b/src/fe-gnome/apps_xchat.schemas.in
@@ -232,6 +232,17 @@
 			</locale>
 		</schema>
 
+                <schema>
+                        <key>/schemas/apps/xchat/main_window/show_statusbar</key>
+                        <applyto>/apps/xchat/main_window/show_statusbar</applyto>
+                        <owner>xchat</owner>
+                        <type>bool</type>
+                        <default>true</default>
+                        <locale name="C">
+                                <short>Whether the statusbar in the main window is shown</short>
+                        </locale>
+                </schema>
+
 		<schema>
 			<key>/schemas/apps/xchat/main_window/hpane</key>
 			<applyto>/apps/xchat/main_window/hpane</applyto>
diff --git a/src/fe-gnome/main-window.c b/src/fe-gnome/main-window.c
index 1f9303a..82d58eb 100644
--- a/src/fe-gnome/main-window.c
+++ b/src/fe-gnome/main-window.c
@@ -76,6 +76,7 @@ static void on_help_about_activate (GtkAction *action, gpointer data);
 static void on_nickname_clicked (GtkButton *widget, gpointer user_data);
 static void on_users_toggled (GtkToggleButton *widget, gpointer user_data);
 static void on_sidebar_toggled (GtkToggleAction *action, gpointer user_data);
+static void on_statusbar_toggled (GtkToggleAction *action, gpointer user_data);
 
 static void on_add_widget (GtkUIManager *manager, GtkWidget *menu, GtkWidget *menu_vbox);
 
@@ -135,7 +136,8 @@ static GtkActionEntry action_entries [] = {
 static const GtkToggleActionEntry toggle_action_entries [] =
 {
 	/* View menu */
-	{ "ViewShowSidebar", NULL, N_("_Sidebar"), "F9", "", G_CALLBACK (on_sidebar_toggled), TRUE }
+	{ "ViewShowSidebar", NULL, N_("_Sidebar"), "F9", "", G_CALLBACK (on_sidebar_toggled), TRUE },
+        { "ViewStatusbar", NULL, N_("_Statusbar"), "", "", G_CALLBACK (on_statusbar_toggled), TRUE }
 };
 
 void
@@ -268,15 +270,16 @@ run_main_window ()
 	g_signal_connect(G_OBJECT(pane), "notify::position",
 	                 G_CALLBACK(on_hpane_move), NULL);
 
+	gboolean val;
+	GtkAction *action;
 
-	GtkAction *action = gtk_action_group_get_action(gui.action_group,
-	                                                "ViewShowSidebar");
-	gboolean sidebar =
-		gconf_client_get_bool(client,
-		                      "/apps/xchat/main_window/show_hpane",
-		                      NULL);
-	gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), sidebar);
+	action = gtk_action_group_get_action(gui.action_group, "ViewShowSidebar");
+	val = gconf_client_get_bool(client, "/apps/xchat/main_window/show_hpane", NULL);
+	gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), val);
 
+	action = gtk_action_group_get_action(gui.action_group, "ViewStatusbar");        
+	val = gconf_client_get_bool(client, "/apps/xchat/main_window/show_statusbar",NULL);
+	gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), val);
 
 	g_object_unref (client);
 
@@ -544,6 +547,24 @@ on_sidebar_toggled (GtkToggleAction *action, gpointer data)
 }
 
 static void
+on_statusbar_toggled (GtkToggleAction *action, gpointer data)
+{
+        GConfClient *client;
+        client = gconf_client_get_default();
+        gconf_client_set_bool(client,
+                              "/apps/xchat/main_window/show_statusbar",
+                              gtk_toggle_action_get_active(action),
+                              NULL);
+        g_object_unref(client);
+
+        if (gtk_toggle_action_get_active(action)) {
+                gtk_widget_show(gui.status_bar);
+        } else {
+                gtk_widget_hide(gui.status_bar);
+        }
+}
+
+static void
 nickname_dialog_entry_activated (GtkEntry *entry, GtkDialog *dialog)
 {
 	gtk_dialog_response (dialog, GTK_RESPONSE_OK);



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