[gthumb/ext: 6/79] Added fullscreen mode



commit 1d5a0a85b7eeb83672c623b7e1ebd3e8ad149b0c
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Jun 14 22:01:10 2009 +0200

    Added fullscreen mode

 extensions/file_viewer/gth-file-viewer-page.c   |    9 +++
 extensions/file_viewer/main.c                   |    2 +-
 extensions/image_viewer/gth-image-viewer-page.c |   32 +++++----
 extensions/image_viewer/main.c                  |    2 +-
 gthumb/gth-browser-actions-callbacks.c          |    8 ++
 gthumb/gth-browser-actions-callbacks.h          |    1 +
 gthumb/gth-browser-actions-entries.h            |    5 ++
 gthumb/gth-browser-ui.h                         |    4 +
 gthumb/gth-browser.c                            |   48 +++++++++++--
 gthumb/gth-browser.h                            |    1 +
 gthumb/gth-main.c                               |   38 +++++++++++
 gthumb/gth-main.h                               |    7 +-
 gthumb/gth-viewer-page.c                        |    7 ++
 gthumb/gth-viewer-page.h                        |    4 +
 gthumb/gth-window.c                             |   82 ++++++++++++++++++-----
 gthumb/gth-window.h                             |    2 +
 16 files changed, 209 insertions(+), 43 deletions(-)
---
diff --git a/extensions/file_viewer/gth-file-viewer-page.c b/extensions/file_viewer/gth-file-viewer-page.c
index 4f55b94..28b4618 100644
--- a/extensions/file_viewer/gth-file-viewer-page.c
+++ b/extensions/file_viewer/gth-file-viewer-page.c
@@ -123,6 +123,14 @@ gth_file_viewer_page_real_view (GthViewerPage *base,
 
 
 static void
+gth_file_viewer_page_real_fullscreen (GthViewerPage *base,
+				      gboolean       active)
+{
+	/* void */
+}
+
+
+static void
 gth_file_viewer_page_real_update_sensitivity (GthViewerPage *base)
 {
 }
@@ -161,6 +169,7 @@ gth_viewer_page_interface_init (GthViewerPageIface *iface)
 	iface->hide = gth_file_viewer_page_real_hide;
 	iface->can_view = gth_file_viewer_page_real_can_view;
 	iface->view = gth_file_viewer_page_real_view;
+	iface->fullscreen = gth_file_viewer_page_real_fullscreen;
 	iface->update_sensitivity = gth_file_viewer_page_real_update_sensitivity;
 	iface->can_save = gth_file_viewer_page_real_can_save;
 }
diff --git a/extensions/file_viewer/main.c b/extensions/file_viewer/main.c
index cbf52f3..a83d43d 100644
--- a/extensions/file_viewer/main.c
+++ b/extensions/file_viewer/main.c
@@ -30,7 +30,7 @@
 G_MODULE_EXPORT void
 gthumb_extension_activate (void)
 {
-	gth_main_register_viewer_page (GTH_TYPE_FILE_VIEWER_PAGE);
+	gth_main_register_object ("viewer-page", GTH_TYPE_FILE_VIEWER_PAGE);
 }
 
 
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index eb727c7..3eb2d0f 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -58,7 +58,7 @@ static const char *image_viewer_ui_info =
 "  <toolbar name='ViewerToolBar'>"
 "    <placeholder name='ViewerCommands'>"
 "      <separator/>"
-"      <toolitem action='ImageViewer_View_Fullscreen'/>"
+"      <toolitem action='View_Fullscreen'/>"
 "      <separator/>"
 "      <toolitem action='ImageViewer_View_ZoomIn'/>"
 "      <toolitem action='ImageViewer_View_ZoomOut'/>"
@@ -74,13 +74,6 @@ static const char *image_viewer_ui_info =
 
 
 static void
-image_viewer_activate_action_view_fullscreen (GtkAction          *action,
-					      GthImageViewerPage *self)
-{
-}
-
-
-static void
 image_viewer_activate_action_view_zoom_in (GtkAction          *action,
 					   GthImageViewerPage *self)
 {
@@ -147,11 +140,6 @@ static GtkActionEntry image_viewer_action_entries[] = {
 	  NULL,
 	  G_CALLBACK (image_viewer_activate_action_edit_redo) },
 
-	{ "ImageViewer_View_Fullscreen", GTK_STOCK_FULLSCREEN,
-	  NULL, "F11",
-	  NULL,
-	  G_CALLBACK (image_viewer_activate_action_view_fullscreen) },
-
 	{ "ImageViewer_View_ZoomIn", GTK_STOCK_ZOOM_IN,
 	  N_("In"), "<control>plus",
 	  N_("Zoom in"),
@@ -589,6 +577,23 @@ gth_image_viewer_page_real_view (GthViewerPage *base,
 				  prev_file_data);
 }
 
+
+static void
+gth_image_viewer_page_real_fullscreen (GthViewerPage *base,
+				       gboolean       active)
+{
+	GthImageViewerPage *self;
+
+	self = (GthImageViewerPage *) base;
+	if (active) {
+		gth_image_viewer_set_black_background (GTH_IMAGE_VIEWER (self->priv->viewer), TRUE);
+	}
+	else {
+		gth_image_viewer_set_black_background (GTH_IMAGE_VIEWER (self->priv->viewer), eel_gconf_get_boolean (PREF_BLACK_BACKGROUND, FALSE));
+	}
+}
+
+
 static void
 _set_action_sensitive (GthImageViewerPage *self,
 		       const char         *action_name,
@@ -978,6 +983,7 @@ gth_viewer_page_interface_init (GthViewerPageIface *iface)
 	iface->hide = gth_image_viewer_page_real_hide;
 	iface->can_view = gth_image_viewer_page_real_can_view;
 	iface->view = gth_image_viewer_page_real_view;
+	iface->fullscreen = gth_image_viewer_page_real_fullscreen;
 	iface->update_sensitivity = gth_image_viewer_page_real_update_sensitivity;
 	iface->can_save = gth_image_viewer_page_real_can_save;
 	iface->save = gth_image_viewer_page_real_save;
diff --git a/extensions/image_viewer/main.c b/extensions/image_viewer/main.c
index 57e1a06..e95d482 100644
--- a/extensions/image_viewer/main.c
+++ b/extensions/image_viewer/main.c
@@ -47,8 +47,8 @@ gthumb_extension_activate (void)
 {
 	gth_main_register_metadata_category (image_metadata_category);
 	gth_main_register_metadata_info_v (image_metadata_info);
-	gth_main_register_viewer_page (GTH_TYPE_IMAGE_VIEWER_PAGE);
 	gth_main_register_metadata_provider (GTH_TYPE_METADATA_PROVIDER_IMAGE);
+	gth_main_register_object ("viewer-page", GTH_TYPE_IMAGE_VIEWER_PAGE);
 	gth_hook_add_callback ("dlg-preferences-construct", 10, G_CALLBACK (image_viewer__dlg_preferences_construct_cb), NULL);
 }
 
diff --git a/gthumb/gth-browser-actions-callbacks.c b/gthumb/gth-browser-actions-callbacks.c
index 9ea9842..e2a5f04 100644
--- a/gthumb/gth-browser-actions-callbacks.c
+++ b/gthumb/gth-browser-actions-callbacks.c
@@ -187,6 +187,14 @@ gth_browser_activate_action_view_filterbar (GtkAction  *action,
 
 
 void
+gth_browser_activate_action_view_fullscreen (GtkAction  *action,
+					     GthBrowser *browser)
+{
+	gth_browser_fullscreen (browser);
+}
+
+
+void
 gth_browser_activate_action_view_sort_by (GtkAction  *action,
 					  GthBrowser *browser)
 {
diff --git a/gthumb/gth-browser-actions-callbacks.h b/gthumb/gth-browser-actions-callbacks.h
index f9ca94c..7626888 100644
--- a/gthumb/gth-browser-actions-callbacks.h
+++ b/gthumb/gth-browser-actions-callbacks.h
@@ -51,6 +51,7 @@ DEFINE_ACTION(gth_browser_activate_action_help_about)
 DEFINE_ACTION(gth_browser_activate_action_view_sort_by)
 DEFINE_ACTION(gth_browser_activate_action_view_filter)
 DEFINE_ACTION(gth_browser_activate_action_view_filterbar)
+DEFINE_ACTION(gth_browser_activate_action_view_fullscreen)
 DEFINE_ACTION(gth_browser_activate_action_view_thumbnails)
 DEFINE_ACTION(gth_browser_activate_action_view_toolbar)
 DEFINE_ACTION(gth_browser_activate_action_view_show_hidden_files)
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index 81546bc..31e0bda 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -115,6 +115,11 @@ static GtkActionEntry gth_browser_action_entries[] = {
 	  N_("View next image"),
 	  G_CALLBACK (gth_browser_activate_action_view_next) },
 
+	{ "View_Fullscreen", GTK_STOCK_FULLSCREEN,
+	  NULL, "F11",
+	  NULL,
+	  G_CALLBACK (gth_browser_activate_action_view_fullscreen) },
+
 	{ "Go_Back", GTK_STOCK_GO_BACK,
 	  NULL, "<alt>Left",
 	  N_("Go to the previous visited location"),
diff --git a/gthumb/gth-browser-ui.h b/gthumb/gth-browser-ui.h
index 9cadca2..385be14 100644
--- a/gthumb/gth-browser-ui.h
+++ b/gthumb/gth-browser-ui.h
@@ -64,6 +64,8 @@ static const char *fixed_ui_info =
 "      <menuitem action='View_Statusbar'/>"
 "      <placeholder name='View_Bars'/>"
 "      <separator/>"
+"      <menuitem action='View_Fullscreen'/>"
+"      <separator/>"
 "      <placeholder name='File_Actions'/>"
 "      <separator/>"
 "      <placeholder name='Folder_Actions'/>"
@@ -177,6 +179,8 @@ static const char *browser_ui_info =
 "  <toolbar name='ToolBar'>"
 "    <placeholder name='BrowserCommands'>"
 "      <toolitem action='Edit_Metadata'/>"
+"        <separator/>"
+"      <toolitem action='View_Fullscreen'/>"
 "    </placeholder>"
 "  </toolbar>"
 "</ui>";
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 630dcc8..c347399 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -137,6 +137,7 @@ struct _GthBrowserPrivateData {
 	gulong             task_completed;
 	GList             *load_data_queue;
 	guint              load_file_timeout;
+	gboolean           fullscreen;
 
 	/* history */
 
@@ -463,7 +464,7 @@ gth_browser_update_sensitivity (GthBrowser *browser)
 	_gth_browser_set_action_sensitive (browser, "File_Revert", viewer_can_save && modified);
 	_gth_browser_set_action_sensitive (browser, "Go_Up", parent_available);
 	_gth_browser_set_action_sensitive (browser, "Toolbar_Go_Up", parent_available);
-	_gth_browser_set_action_sensitive (browser, "View_Stop", (browser->priv->activity_ref > 0));
+	_gth_browser_set_action_sensitive (browser, "View_Stop", browser->priv->fullscreen || (browser->priv->activity_ref > 0));
 	_gth_browser_set_action_sensitive (browser, "View_Prev", current_file_pos > 0);
 	_gth_browser_set_action_sensitive (browser, "View_Next", (current_file_pos != -1) && (current_file_pos < n_files - 1));
 	_gth_browser_set_action_sensitive (browser, "Edit_Metadata", n_selected > 0);
@@ -2152,7 +2153,7 @@ _gth_browser_update_statusbar_file_info (GthBrowser *browser)
 	file_size = g_file_info_get_attribute_string (browser->priv->current_file->info, "file::display-size");
 
 	if (gth_browser_get_file_modified (browser))
-		text = g_strdup_printf ("%s - %s", _("Modified"), image_size);
+		text = g_strdup_printf ("%s - %s", image_size, _("Modified"));
 	else if (image_size != NULL)
 		text = g_strdup_printf ("%s - %s - %s",	image_size, file_size, file_date);
 	else
@@ -3096,6 +3097,9 @@ gth_browser_set_sort_order (GthBrowser      *browser,
 void
 gth_browser_stop (GthBrowser *browser)
 {
+	if (browser->priv->fullscreen)
+		gth_browser_fullscreen (browser);
+
 	_gth_browser_cancel (browser);
 
 	gth_browser_update_sensitivity (browser);
@@ -3445,9 +3449,9 @@ _gth_browser_load_file (GthBrowser  *browser,
 			GthFileData *file_data,
 			gboolean     view)
 {
-	GList *list;
-	GList *scan;
-	GList *files;
+	GPtrArray *viewer_pages;
+	int       i;
+	GList    *files;
 
 	if (file_data == NULL) {
 		_gth_browser_deactivate_viewer_page (browser);
@@ -3472,10 +3476,11 @@ _gth_browser_load_file (GthBrowser  *browser,
 
 	_gth_browser_make_file_visible (browser, browser->priv->current_file);
 
-	list = gth_main_get_all_viewer_pages ();
-	for (scan = list; scan; scan = scan->next) {
-		GthViewerPage *registered_viewer_page = scan->data;
+	viewer_pages = gth_main_get_object_set ("viewer-page");
+	for (i = viewer_pages->len - 1; i >= 0; i--) {
+		GthViewerPage *registered_viewer_page;
 
+		registered_viewer_page = g_ptr_array_index (viewer_pages, i);
 		if (gth_viewer_page_can_view (registered_viewer_page, browser->priv->current_file)) {
 			if ((browser->priv->viewer_page != NULL) && (G_OBJECT_TYPE (registered_viewer_page) != G_OBJECT_TYPE (browser->priv->viewer_page))) {
 				gth_viewer_page_deactivate (browser->priv->viewer_page);
@@ -3769,3 +3774,30 @@ gth_browser_get_image_preloader (GthBrowser *browser)
 {
 	return g_object_ref (browser->priv->image_preloader);
 }
+
+
+void
+gth_browser_fullscreen (GthBrowser *browser)
+{
+	if (browser->priv->viewer_page == NULL)
+		return;
+
+	browser->priv->fullscreen = ! browser->priv->fullscreen;
+
+	if (browser->priv->fullscreen) {
+		gtk_window_fullscreen (GTK_WINDOW (browser));
+
+		gth_viewer_page_show (browser->priv->viewer_page);
+		gth_window_set_current_page (GTH_WINDOW (browser), GTH_BROWSER_PAGE_VIEWER);
+		gth_window_show_only_content (GTH_WINDOW (browser), TRUE);
+		gth_viewer_page_fullscreen (browser->priv->viewer_page, TRUE);
+	}
+	else {
+		gtk_window_unfullscreen (GTK_WINDOW (browser));
+
+		gth_window_show_only_content (GTH_WINDOW (browser), FALSE);
+		gth_viewer_page_fullscreen (browser->priv->viewer_page, FALSE);
+	}
+
+	gth_browser_update_sensitivity (browser);
+}
diff --git a/gthumb/gth-browser.h b/gthumb/gth-browser.h
index 398e3f9..76bcf6b 100644
--- a/gthumb/gth-browser.h
+++ b/gthumb/gth-browser.h
@@ -142,6 +142,7 @@ void             gth_browser_enable_thumbnails      (GthBrowser       *browser,
 void             gth_browser_show_filterbar         (GthBrowser       *browser,
 						     gboolean          show);
 gpointer         gth_browser_get_image_preloader    (GthBrowser       *browser);
+void             gth_browser_fullscreen             (GthBrowser       *browser);
 
 G_END_DECLS
 
diff --git a/gthumb/gth-main.c b/gthumb/gth-main.c
index 8e6c2c6..aef8ccc 100644
--- a/gthumb/gth-main.c
+++ b/gthumb/gth-main.c
@@ -96,6 +96,7 @@ struct _GthMainPrivate
 	GHashTable          *loaders;
 	GList               *viewer_pages;
 	GHashTable          *types;
+	GHashTable          *objects;
 	GBookmarkFile       *bookmarks;
 	GthFilterFile       *filters;
 	GthMonitor          *monitor;
@@ -822,6 +823,43 @@ gth_main_get_type_set (const char *set_name)
 }
 
 
+static void
+_g_destroy_object_array (GPtrArray *array)
+{
+	g_ptr_array_foreach (array, (GFunc) g_object_unref, NULL);
+	g_ptr_array_free (array, TRUE);
+}
+
+
+void
+gth_main_register_object (const char *set_name,
+			  GType       object_type)
+{
+	GPtrArray *set;
+
+	if (Main->priv->objects == NULL)
+		Main->priv->objects = g_hash_table_new_full (g_str_hash,
+							     g_str_equal,
+							     (GDestroyNotify) g_free,
+							     (GDestroyNotify) _g_destroy_object_array);
+
+	set = g_hash_table_lookup (Main->priv->objects, set_name);
+	if (set == NULL) {
+		set = g_ptr_array_new ();
+		g_hash_table_insert (Main->priv->objects, g_strdup (set_name), set);
+	}
+
+	g_ptr_array_add (set, g_object_new (object_type, NULL));
+}
+
+
+GPtrArray *
+gth_main_get_object_set (const char *set_name)
+{
+	return g_hash_table_lookup (Main->priv->objects, set_name);
+}
+
+
 GBookmarkFile *
 gth_main_get_default_bookmarks (void)
 {
diff --git a/gthumb/gth-main.h b/gthumb/gth-main.h
index 1a0ee44..c04b439 100644
--- a/gthumb/gth-main.h
+++ b/gthumb/gth-main.h
@@ -86,7 +86,7 @@ void                   gth_main_register_sort_type            (GthFileDataSort
 GthFileDataSort *      gth_main_get_sort_type                 (const char           *name);
 GList *                gth_main_get_all_sort_types            (void);
 void                   gth_main_register_test                 (const char           *id,
-						               GType                 type,			
+						               GType                 type,
 						               const char           *first_property,
 						              ...);
 GthTest *              gth_main_get_test                      (const char           *id);
@@ -97,8 +97,9 @@ void                   gth_main_register_file_loader          (FileLoader
 FileLoader             gth_main_get_file_loader               (const char           *mime_type);
 GthTest *              gth_main_get_general_filter            (void);
 GthTest *              gth_main_add_general_filter            (GthTest              *filter);
-void                   gth_main_register_viewer_page          (GType                 viewer_page_type);
-GList *                gth_main_get_all_viewer_pages          (void);
+void                   gth_main_register_object               (const char           *set_name,
+							       GType                 object_type);
+GPtrArray *            gth_main_get_object_set                (const char           *set_name);
 void                   gth_main_register_type                 (const char           *set_name,
 							       GType                 object_type);
 GArray *               gth_main_get_type_set                  (const char           *set_name);
diff --git a/gthumb/gth-viewer-page.c b/gthumb/gth-viewer-page.c
index fecb51a..6c8ee76 100644
--- a/gthumb/gth-viewer-page.c
+++ b/gthumb/gth-viewer-page.c
@@ -93,6 +93,13 @@ gth_viewer_page_view (GthViewerPage *self,
 
 
 void
+gth_viewer_page_fullscreen (GthViewerPage *self,
+			    gboolean       active)
+{
+	GTH_VIEWER_PAGE_GET_INTERFACE (self)->fullscreen (self, active);
+}
+
+void
 gth_viewer_page_update_sensitivity (GthViewerPage *self)
 {
 	GTH_VIEWER_PAGE_GET_INTERFACE (self)->update_sensitivity (self);
diff --git a/gthumb/gth-viewer-page.h b/gthumb/gth-viewer-page.h
index 95aa770..0377d2b 100644
--- a/gthumb/gth-viewer-page.h
+++ b/gthumb/gth-viewer-page.h
@@ -54,6 +54,8 @@ struct _GthViewerPageIface {
 				 	  GthFileData   *file_data);
 	void      (*view)                (GthViewerPage *self,
 				 	  GthFileData   *file_data);
+	void      (*fullscreen)          (GthViewerPage *self,
+					  gboolean       active);
 	void      (*update_sensitivity)  (GthViewerPage *self);
 	gboolean  (*can_save)            (GthViewerPage *self);
 	void      (*save)                (GthViewerPage *self,
@@ -75,6 +77,8 @@ gboolean     gth_viewer_page_can_view            (GthViewerPage  *self,
 						  GthFileData    *file_data);
 void         gth_viewer_page_view                (GthViewerPage  *self,
 						  GthFileData    *file_data);
+void         gth_viewer_page_fullscreen          (GthViewerPage  *self,
+						  gboolean       active);
 void         gth_viewer_page_update_sensitivity  (GthViewerPage  *self);
 gboolean     gth_viewer_page_can_save            (GthViewerPage  *self);
 void         gth_viewer_page_save                (GthViewerPage  *self,
diff --git a/gthumb/gth-window.c b/gthumb/gth-window.c
index 95426dc..458aac4 100644
--- a/gthumb/gth-window.c
+++ b/gthumb/gth-window.c
@@ -43,8 +43,11 @@ struct _GthWindowPrivate {
 	int         current_page;
 	GtkWidget  *table;
 	GtkWidget  *notebook;
-	GtkWidget **toolbar;
-	GtkWidget **content;
+	GtkWidget  *menubar;
+	GtkWidget  *toolbar;
+	GtkWidget  *statusbar;
+	GtkWidget **toolbars;
+	GtkWidget **contents;
 };
 
 
@@ -72,8 +75,8 @@ gth_window_set_n_pages (GthWindow *self,
 			  GTK_EXPAND | GTK_FILL,
 			  0, 0);
 
-	self->priv->toolbar = g_new0 (GtkWidget *, n_pages);
-	self->priv->content = g_new0 (GtkWidget *, n_pages);
+	self->priv->toolbars = g_new0 (GtkWidget *, n_pages);
+	self->priv->contents = g_new0 (GtkWidget *, n_pages);
 
 	for (i = 0; i < n_pages; i++) {
 		GtkWidget *page;
@@ -84,13 +87,13 @@ gth_window_set_n_pages (GthWindow *self,
 					  page,
 					  NULL);
 
-		self->priv->toolbar[i] = gtk_hbox_new (FALSE, 0);
-		gtk_widget_show (self->priv->toolbar[i]);
-		gtk_box_pack_start (GTK_BOX (page), self->priv->toolbar[i], FALSE, FALSE, 0);
+		self->priv->toolbars[i] = gtk_hbox_new (FALSE, 0);
+		gtk_widget_show (self->priv->toolbars[i]);
+		gtk_box_pack_start (GTK_BOX (page), self->priv->toolbars[i], FALSE, FALSE, 0);
 
-		self->priv->content[i] = gtk_hbox_new (FALSE, 0);
-		gtk_widget_show (self->priv->content[i]);
-		gtk_box_pack_start (GTK_BOX (page), self->priv->content[i], TRUE, TRUE, 0);
+		self->priv->contents[i] = gtk_hbox_new (FALSE, 0);
+		gtk_widget_show (self->priv->contents[i]);
+		gtk_box_pack_start (GTK_BOX (page), self->priv->contents[i], TRUE, TRUE, 0);
 	}
 }
 
@@ -121,8 +124,8 @@ gth_window_finalize (GObject *object)
 {
 	GthWindow *window = GTH_WINDOW (object);
 
-	g_free (window->priv->toolbar);
-	g_free (window->priv->content);
+	g_free (window->priv->toolbars);
+	g_free (window->priv->contents);
 
 	window_list = g_list_remove (window_list, window);
 
@@ -196,9 +199,12 @@ gth_window_init (GthWindow *window)
 {
 	window->priv = GTH_WINDOW_GET_PRIVATE (window);
 	window->priv->table = NULL;
-	window->priv->content = NULL;
+	window->priv->contents = NULL;
 	window->priv->n_pages = 0;
 	window->priv->current_page = -1;
+	window->priv->menubar = NULL;
+	window->priv->toolbar = NULL;
+	window->priv->statusbar = NULL;
 
 	window_list = g_list_prepend (window_list, window);
 }
@@ -253,12 +259,15 @@ gth_window_attach (GthWindow     *window,
 
 	switch (area) {
 	case GTH_WINDOW_MENUBAR:
+		window->priv->menubar = child;
 		position = 0;
 		break;
 	case GTH_WINDOW_TOOLBAR:
+		window->priv->toolbar = child;
 		position = 1;
 		break;
 	case GTH_WINDOW_STATUSBAR:
+		window->priv->statusbar = child;
 		position = 3;
 		break;
 	default:
@@ -286,8 +295,8 @@ gth_window_attach_toolbar (GthWindow *window,
 	g_return_if_fail (child != NULL);
 	g_return_if_fail (GTK_IS_WIDGET (child));
 
-	_gtk_container_remove_children (GTK_CONTAINER (window->priv->toolbar[page]), NULL, NULL);
-	gtk_container_add (GTK_CONTAINER (window->priv->toolbar[page]), child);
+	_gtk_container_remove_children (GTK_CONTAINER (window->priv->toolbars[page]), NULL, NULL);
+	gtk_container_add (GTK_CONTAINER (window->priv->toolbars[page]), child);
 }
 
 
@@ -302,8 +311,8 @@ gth_window_attach_content (GthWindow *window,
 	g_return_if_fail (child != NULL);
 	g_return_if_fail (GTK_IS_WIDGET (child));
 
-	_gtk_container_remove_children (GTK_CONTAINER (window->priv->content[page]), NULL, NULL);
-	gtk_container_add (GTK_CONTAINER (window->priv->content[page]), child);
+	_gtk_container_remove_children (GTK_CONTAINER (window->priv->contents[page]), NULL, NULL);
+	gtk_container_add (GTK_CONTAINER (window->priv->contents[page]), child);
 }
 
 
@@ -322,6 +331,45 @@ gth_window_get_current_page (GthWindow *window)
 }
 
 
+static void
+hide_widget (GtkWidget *widget)
+{
+	if (widget != NULL)
+		gtk_widget_hide (widget);
+}
+
+
+static void
+show_widget (GtkWidget *widget)
+{
+	if (widget != NULL)
+		gtk_widget_show (widget);
+}
+
+
+void
+gth_window_show_only_content (GthWindow *window,
+			      gboolean   only_content)
+{
+	int i;
+
+	if (only_content) {
+		for (i = 0; i < window->priv->n_pages; i++)
+			hide_widget (window->priv->toolbars[i]);
+		hide_widget (window->priv->menubar);
+		hide_widget (window->priv->toolbar);
+		hide_widget (window->priv->statusbar);
+	}
+	else {
+		for (i = 0; i < window->priv->n_pages; i++)
+			show_widget (window->priv->toolbars[i]);
+		show_widget (window->priv->menubar);
+		show_widget (window->priv->toolbar);
+		show_widget (window->priv->statusbar);
+	}
+}
+
+
 int
 gth_window_get_n_windows (void)
 {
diff --git a/gthumb/gth-window.h b/gthumb/gth-window.h
index 1ffab6e..24b3839 100644
--- a/gthumb/gth-window.h
+++ b/gthumb/gth-window.h
@@ -75,6 +75,8 @@ void           gth_window_attach_content     (GthWindow     *window,
 void           gth_window_set_current_page   (GthWindow     *window,
 					      int            page);
 int            gth_window_get_current_page   (GthWindow     *window);
+void           gth_window_show_only_content  (GthWindow     *window,
+					      gboolean       only_content);
 
 /**/
 



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