[xchat-gnome] Bug 445638 - Fullscreen mode



commit 57c9167984daaddf759fabeb21395631b0656f3a
Author: Ritesh Khadgaray <khadgaray gmail com>
Date:   Sat Oct 24 00:08:48 2009 +0530

    Bug 445638 -  Fullscreen mode
    
    Part of "bz#582011 - Tracker bug: small screen support for Eee"

 data/xchat-gnome-ui.xml    |    2 ++
 src/fe-gnome/fe-gnome.c    |   10 ++++++----
 src/fe-gnome/main-window.c |   20 ++++++++++++++++++--
 src/fe-gnome/main-window.h |    2 +-
 4 files changed, 27 insertions(+), 7 deletions(-)
---
diff --git a/data/xchat-gnome-ui.xml b/data/xchat-gnome-ui.xml
index 22afabf..4c7963d 100644
--- a/data/xchat-gnome-ui.xml
+++ b/data/xchat-gnome-ui.xml
@@ -47,6 +47,8 @@
 			<separator name="ViewSep1"/>
 			<menuitem name="ViewShowSidebar" action="ViewShowSidebar"/>
 			<menuitem name="ViewShowStatusbar" action="ViewStatusbar"/>
+			<separator name="ViewSep11"/>
+			<menuitem name="ViewFullscreen" action="ViewFullscreen"/>
 		</menu>
 
 		<menu name="HelpMenu" action="Help">
diff --git a/src/fe-gnome/fe-gnome.c b/src/fe-gnome/fe-gnome.c
index fa5530d..b4168ce 100644
--- a/src/fe-gnome/fe-gnome.c
+++ b/src/fe-gnome/fe-gnome.c
@@ -54,11 +54,13 @@
 #include "../common/cfgfiles.h"
 #include "../common/plugin.h"
 
-static gboolean  opt_version   = FALSE;
-static gboolean  opt_noplugins = FALSE;
-static gchar    *opt_cfgdir    = NULL;
+static gboolean  opt_fullscreen = FALSE;
+static gboolean  opt_version    = FALSE;
+static gboolean  opt_noplugins  = FALSE;
+static gchar    *opt_cfgdir     = NULL;
 
 static GOptionEntry entries[] = {
+	{"full-screen",'f', 0, G_OPTION_ARG_NONE,     &opt_fullscreen,	     N_("Full-screen the window"),                          NULL},
 	{"cfgdir",     'd', 0, G_OPTION_ARG_FILENAME, &opt_cfgdir,           N_("Use directory instead of the default config dir"), "directory"},
 	{"no-auto",    'a', 0, G_OPTION_ARG_NONE,     &arg_dont_autoconnect, N_("Don't auto-connect to servers"),                   NULL},
 	{"no-plugins", 'n', 0, G_OPTION_ARG_NONE,     &opt_noplugins,        N_("Don't auto-load plugins"),                         NULL},
@@ -149,7 +151,7 @@ fe_init (void)
 	servlist_init ();
 	initialize_gui_2 ();
 	load_preferences ();
-	run_main_window ();
+	run_main_window (opt_fullscreen);
 
 	/* Force various window-related options to match our interaction model */
 	prefs.use_server_tab = TRUE;
diff --git a/src/fe-gnome/main-window.c b/src/fe-gnome/main-window.c
index 82d58eb..ad34098 100644
--- a/src/fe-gnome/main-window.c
+++ b/src/fe-gnome/main-window.c
@@ -77,6 +77,7 @@ 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_fullscreen_toggled (GtkToggleAction *action, gpointer user_data);
 
 static void on_add_widget (GtkUIManager *manager, GtkWidget *menu, GtkWidget *menu_vbox);
 
@@ -137,7 +138,8 @@ static const GtkToggleActionEntry toggle_action_entries [] =
 {
 	/* View menu */
 	{ "ViewShowSidebar", NULL, N_("_Sidebar"), "F9", "", G_CALLBACK (on_sidebar_toggled), TRUE },
-        { "ViewStatusbar", NULL, N_("_Statusbar"), "", "", G_CALLBACK (on_statusbar_toggled), TRUE }
+        { "ViewStatusbar", NULL, N_("_Statusbar"), "", "", G_CALLBACK (on_statusbar_toggled), TRUE },
+	{ "ViewFullscreen", NULL, N_("_Fullscreen"), "F11", "", G_CALLBACK (on_fullscreen_toggled), FALSE }
 };
 
 void
@@ -234,7 +236,7 @@ initialize_main_window (void)
 }
 
 void
-run_main_window ()
+run_main_window (gboolean fullscreen)
 {
 	GConfClient *client = gconf_client_get_default();
 
@@ -284,6 +286,10 @@ run_main_window ()
 	g_object_unref (client);
 
 	gtk_widget_show (gui.main_window);
+
+	action = gtk_action_group_get_action(gui.action_group,
+                                                        "ViewFullscreen");
+	gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), fullscreen);
 }
 
 void
@@ -565,6 +571,16 @@ on_statusbar_toggled (GtkToggleAction *action, gpointer data)
 }
 
 static void
+on_fullscreen_toggled (GtkToggleAction *action, gpointer data)
+{
+	if (gtk_toggle_action_get_active(action)) {
+		gtk_window_fullscreen( GTK_WINDOW(gui.main_window));
+	} else {
+		gtk_window_unfullscreen( GTK_WINDOW(gui.main_window));
+	}
+}
+
+static void
 nickname_dialog_entry_activated (GtkEntry *entry, GtkDialog *dialog)
 {
 	gtk_dialog_response (dialog, GTK_RESPONSE_OK);
diff --git a/src/fe-gnome/main-window.h b/src/fe-gnome/main-window.h
index 2b36809..7cb350f 100644
--- a/src/fe-gnome/main-window.h
+++ b/src/fe-gnome/main-window.h
@@ -25,7 +25,7 @@
 #define XCHAT_GNOME_MAIN_WINDOW_H
 
 void initialize_main_window (void);
-void run_main_window        (void);
+void run_main_window        (gboolean fullscreen);
 void save_main_window       (void);
 void rename_main_window     (gchar *server, gchar *channel);
 void set_nickname_label     (struct server *serv, char *newnick);



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