gtranslator r3466 - in branches/GOBJECT_WORK: . data plugins/charmap plugins/dictionary plugins/open-tran src src/dialogs



Author: icq
Date: Tue Jan 29 19:17:26 2008
New Revision: 3466
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3466&view=rev

Log:
2008-01-29  Ignacio Casal Quinteiro  <nacho resa gmail com>

        * plugins/open-tran/open-tran-plugin.c:
        * plugins/dictionary/dict-panel.c:
        * plugins/dictionary/dictionary-plugin.c:
        * plugins/charmap/charmap-plugin.c:
        * src/prefs-manager-app.c:
        * src/actions.h:
        * src/dialogs/preferences-dialog.c:
        * src/window.c:
        * src/actions-view.c:
        * src/window.h:
        * src/prefs-manager.c:
        * src/prefs-manager.h:
        * configure.ac:
        * data/Makefile.am:
        * data/gtranslator-ui.xml:
        Switched to gdl and removed some useless menus.



Modified:
   branches/GOBJECT_WORK/ChangeLog
   branches/GOBJECT_WORK/configure.ac
   branches/GOBJECT_WORK/data/Makefile.am
   branches/GOBJECT_WORK/data/gtranslator-ui.xml
   branches/GOBJECT_WORK/plugins/charmap/charmap-plugin.c
   branches/GOBJECT_WORK/plugins/dictionary/dict-panel.c
   branches/GOBJECT_WORK/plugins/dictionary/dictionary-plugin.c
   branches/GOBJECT_WORK/plugins/open-tran/open-tran-plugin.c
   branches/GOBJECT_WORK/src/actions-view.c
   branches/GOBJECT_WORK/src/actions.h
   branches/GOBJECT_WORK/src/dialogs/preferences-dialog.c
   branches/GOBJECT_WORK/src/prefs-manager-app.c
   branches/GOBJECT_WORK/src/prefs-manager.c
   branches/GOBJECT_WORK/src/prefs-manager.h
   branches/GOBJECT_WORK/src/window.c
   branches/GOBJECT_WORK/src/window.h

Modified: branches/GOBJECT_WORK/configure.ac
==============================================================================
--- branches/GOBJECT_WORK/configure.ac	(original)
+++ branches/GOBJECT_WORK/configure.ac	Tue Jan 29 19:17:26 2008
@@ -75,6 +75,7 @@
 LIBXML_REQUIRED=2.4.12
 LIBGLADE_REQUIRED=2.6.0
 SOURCEVIEW_REQUIRED=2.0.0
+GDL_REQUIRED=0.6.0
 LIBGUCHARMAP_REQUIRED=1.6.0
 GDICT_REQUIRED=0.10.8
 GTKSPELL_OPTIONAL=2.0.2
@@ -84,6 +85,7 @@
 AC_SUBST(LIBXML_REQUIRED)
 AC_SUBST(LIBGLADE_REQUIRED)
 AC_SUBST(SOURCEVIEW_REQUIRED)
+AC_SUBST(GDL_REQUIRED)
 AC_SUBST(GDICT_REQUIRED)
 AC_SUBST(GTKSPELL_OPTIONAL)
 
@@ -92,6 +94,7 @@
 libxml-2.0 >= $LIBXML_REQUIRED 
 libglade-2.0 >= $LIBGLADE_REQUIRED
 gtksourceview-2.0 >= $SOURCEVIEW_REQUIRED
+gdl-1.0 >= $GDL_REQUIRED
 ])
 
 AC_SUBST(GTRANSLATOR_CFLAGS)

Modified: branches/GOBJECT_WORK/data/Makefile.am
==============================================================================
--- branches/GOBJECT_WORK/data/Makefile.am	(original)
+++ branches/GOBJECT_WORK/data/Makefile.am	Tue Jan 29 19:17:26 2008
@@ -15,7 +15,8 @@
 ui_DATA = \
 		gtranslator-ui.xml \
 		gtr-toolbar.xml \
-		po.lang
+		po.lang \
+		layout.xml
 
 EXTRA_DIST = \
 		$(ui_DATA) \

Modified: branches/GOBJECT_WORK/data/gtranslator-ui.xml
==============================================================================
--- branches/GOBJECT_WORK/data/gtranslator-ui.xml	(original)
+++ branches/GOBJECT_WORK/data/gtranslator-ui.xml	Tue Jan 29 19:17:26 2008
@@ -37,7 +37,7 @@
       <menuitem name="ViewSidePaneMenu" action="ViewSidePane"/>
     </menu>
 
-    <menu name="BookmarksMenu" action="Bookmarks">
+    <?--<menu name="BookmarksMenu" action="Bookmarks">
       <menuitem name="BookmarksAddMenu" action="BookmarksAdd"/>
       <menuitem name="BookmarksEditMenu" action="BookmarksEdit"/>
     </menu>
@@ -49,7 +49,7 @@
       <menuitem name="ActionsAutotranslateMenu" action="ActionsAutotranslate"/>
       <separator/>
       <menuitem name="ActionsRemoveTranslationsMenu" action="ActionsRemoveTranslations"/>
-    </menu>
+    </menu>--?>
 
     <menu name="GoMenu" action="Go">
       <menuitem name="GoFirstMenu" action="GoFirst"/>

Modified: branches/GOBJECT_WORK/plugins/charmap/charmap-plugin.c
==============================================================================
--- branches/GOBJECT_WORK/plugins/charmap/charmap-plugin.c	(original)
+++ branches/GOBJECT_WORK/plugins/charmap/charmap-plugin.c	Tue Jan 29 19:17:26 2008
@@ -27,7 +27,6 @@
 
 #include <glib/gi18n-lib.h>
 #include "window.h"
-#include "panel.h"
 #include <gucharmap/gucharmap-table.h>
 #include <gucharmap/gucharmap-unicode-info.h>
 
@@ -217,35 +216,34 @@
 impl_activate (GtranslatorPlugin *plugin,
 	       GtranslatorWindow *window)
 {
-	GtranslatorPanel *panel;
-	GtkWidget *image;
-	GtkIconTheme *theme;
+	/*GtkWidget *image;
+	GtkIconTheme *theme;*/
 	GtkStatusbar *statusbar;
 	WindowData *data;
 
 	//gtranslator_debug (DEBUG_PLUGINS);
 
-	panel = gtranslator_window_get_side_panel (window);
-
 	data = g_new (WindowData, 1);
 
-	theme = gtk_icon_theme_get_default ();
+	/*theme = gtk_icon_theme_get_default ();
 	
 	if (gtk_icon_theme_has_icon (theme, "accessories-character-map"))
 		image = gtk_image_new_from_icon_name ("accessories-character-map",
 						      GTK_ICON_SIZE_MENU);
 	else
 		image = gtk_image_new_from_icon_name ("gucharmap",
-						      GTK_ICON_SIZE_MENU);
+						      GTK_ICON_SIZE_MENU);*/
 
 	data->panel = create_charmap_panel (window);
 	
-	gtranslator_panel_add_item (panel,
-			      data->panel,
-			      _("Character Map"),
-			      image);
+	gtranslator_window_add_widget (window,
+				       data->panel,
+				       "GtranslatorCharmapPlugin",
+				       _("Character Map"),
+				       NULL,
+				       GTR_WINDOW_PLACEMENT_LEFT);
 
-	gtk_object_sink (GTK_OBJECT (image));
+	//gtk_object_sink (GTK_OBJECT (image));
 
 	statusbar = GTK_STATUSBAR (gtranslator_window_get_statusbar (window));
 	data->context_id = gtk_statusbar_get_context_id (statusbar,
@@ -261,7 +259,6 @@
 impl_deactivate	(GtranslatorPlugin *plugin,
 		 GtranslatorWindow *window)
 {
-	GtranslatorPanel *panel;
 	GucharmapTable *chartable;
 	WindowData *data;
 
@@ -275,9 +272,8 @@
 					(GTR_CHARMAP_PANEL (data->panel));
 	on_table_status_message (chartable, NULL, window);
 
-	panel = gtranslator_window_get_side_panel (window);
-	gtranslator_panel_remove_item (panel, data->panel);
-
+	gtranslator_window_remove_widget (window, data->panel);
+			 
 	g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
 }
 

Modified: branches/GOBJECT_WORK/plugins/dictionary/dict-panel.c
==============================================================================
--- branches/GOBJECT_WORK/plugins/dictionary/dict-panel.c	(original)
+++ branches/GOBJECT_WORK/plugins/dictionary/dict-panel.c	Tue Jan 29 19:17:26 2008
@@ -54,8 +54,6 @@
 struct _GtranslatorDictPanelPrivate
 {
 	GtkPaned   *paned;
-
-	GtkTooltips *tooltips;
   
 	GConfClient *gconf_client;
 	guint notify_id;

Modified: branches/GOBJECT_WORK/plugins/dictionary/dictionary-plugin.c
==============================================================================
--- branches/GOBJECT_WORK/plugins/dictionary/dictionary-plugin.c	(original)
+++ branches/GOBJECT_WORK/plugins/dictionary/dictionary-plugin.c	Tue Jan 29 19:17:26 2008
@@ -21,7 +21,6 @@
 
 #include "dictionary-plugin.h"
 #include "dict-panel.h"
-#include "panel.h"
 #include "window.h"
 
 #include <glib/gi18n-lib.h>
@@ -98,36 +97,35 @@
 impl_activate (GtranslatorPlugin *plugin,
 	       GtranslatorWindow *window)
 {
-	GtranslatorPanel *panel;
-	GtkWidget *image;
-	GtkIconTheme *theme;
+	/*GtkWidget *image;
+	GtkIconTheme *theme;*/
 	WindowData *data;
 
 	//gtranslator_debug (DEBUG_PLUGINS);
 
-	panel = gtranslator_window_get_side_panel (window);
-
 	data = g_new (WindowData, 1);
 
-	theme = gtk_icon_theme_get_default ();
+	/*theme = gtk_icon_theme_get_default ();
 	
 	if (gtk_icon_theme_has_icon (theme, "accessories-dictionary"))
 		image = gtk_image_new_from_icon_name ("accessories-dictionary",
 						      GTK_ICON_SIZE_MENU);
 	else
 		image = gtk_image_new_from_icon_name ("gdict",
-						      GTK_ICON_SIZE_MENU);
+						      GTK_ICON_SIZE_MENU);*/
 
 	data->panel = create_dict_panel (window);
 	
 	restore_position(GTR_DICT_PANEL(data->panel));
 	
-	gtranslator_panel_add_item (panel,
-			      data->panel,
-			      _("Dictionary"),
-			      image);
+	gtranslator_window_add_widget (window,
+				       data->panel,
+				       "GtranslatorDictionaryPlugin",
+				       _("Dictionary"),
+				       NULL,
+				       GTR_WINDOW_PLACEMENT_LEFT);
 
-	gtk_object_sink (GTK_OBJECT (image));
+	//gtk_object_sink (GTK_OBJECT (image));
 
 	g_object_set_data_full (G_OBJECT (window),
 				WINDOW_DATA_KEY,
@@ -139,18 +137,13 @@
 impl_deactivate	(GtranslatorPlugin *plugin,
 		 GtranslatorWindow *window)
 {
-	GtranslatorPanel *panel;
 	WindowData *data;
 
-	//gtranslator_debug (DEBUG_PLUGINS);
-
 	data = (WindowData *) g_object_get_data (G_OBJECT (window),
 						 WINDOW_DATA_KEY);
 	g_return_if_fail (data != NULL);
 
-	panel = gtranslator_window_get_side_panel (window);
-	
-	gtranslator_panel_remove_item (panel, data->panel);
+	gtranslator_window_remove_widget (window, data->panel);
 
 	g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
 }

Modified: branches/GOBJECT_WORK/plugins/open-tran/open-tran-plugin.c
==============================================================================
--- branches/GOBJECT_WORK/plugins/open-tran/open-tran-plugin.c	(original)
+++ branches/GOBJECT_WORK/plugins/open-tran/open-tran-plugin.c	Tue Jan 29 19:17:26 2008
@@ -26,7 +26,6 @@
 
 #include <glib/gi18n-lib.h>
 #include "window.h"
-#include "panel.h"
 
 #define OPEN_TRAN_PLUGIN_ICON PIXMAPSDIR"/open-tran.png"
 #define WINDOW_DATA_KEY	"GtranslatorOpenTranPluginWindowData"
@@ -66,16 +65,13 @@
 impl_activate (GtranslatorPlugin *plugin,
 	       GtranslatorWindow *window)
 {
-	GtranslatorPanel *panel;
-	GtkWidget *image = NULL;
+	//GtkWidget *image = NULL;
 	GtkWidget *opentran;
-	GdkPixbuf *pixbuf;
+	/*GdkPixbuf *pixbuf;
 	GtkIconSet *iconset;
-	GError *error = NULL;
+	GError *error = NULL;*/
 	
-	panel = gtranslator_window_get_side_panel (window);
-
-	pixbuf = gdk_pixbuf_new_from_file(OPEN_TRAN_PLUGIN_ICON, &error);
+	/*pixbuf = gdk_pixbuf_new_from_file(OPEN_TRAN_PLUGIN_ICON, &error);
 	
 	if (error)
 	{
@@ -90,17 +86,17 @@
 	
 		image = gtk_image_new_from_icon_set(iconset,
 						    GTK_ICON_SIZE_MENU);
-	}
+	}*/
 
 	opentran = gtranslator_open_tran_panel_new(window);
 
-	gtranslator_panel_add_item (panel,
-			      opentran,
-			      _("Open-Tran"),
-			      image);
+	gtranslator_window_add_widget (window,
+				       opentran,
+				       "GtranslatorOpenTranPlugin",
+				       _("Open Tran"),
+				       NULL,
+				       GTR_WINDOW_PLACEMENT_LEFT);
 
-	gtk_object_sink (GTK_OBJECT (image));
-	
 	g_object_set_data(G_OBJECT(window),
 			  WINDOW_DATA_KEY,
 			  opentran);
@@ -112,16 +108,14 @@
 impl_deactivate	(GtranslatorPlugin *plugin,
 		 GtranslatorWindow *window)
 {
-	GtranslatorPanel *panel;
 	GtkWidget *opentran;
 
 	opentran = (GtkWidget *) g_object_get_data (G_OBJECT (window),
 						    WINDOW_DATA_KEY);
 	g_return_if_fail (opentran != NULL);
 
-	panel = gtranslator_window_get_side_panel (window);
-	gtranslator_panel_remove_item (panel, opentran);
-
+	gtranslator_window_remove_widget (window, opentran);
+	
 	g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL);
 }
 

Modified: branches/GOBJECT_WORK/src/actions-view.c
==============================================================================
--- branches/GOBJECT_WORK/src/actions-view.c	(original)
+++ branches/GOBJECT_WORK/src/actions-view.c	Tue Jan 29 19:17:26 2008
@@ -16,26 +16,3 @@
  */
 
 #include "actions.h"
-#include "window.h"
-
-void
-gtranslator_actions_view_show_side_pane (GtkAction   *action,
-					 GtranslatorWindow *window)
-{
-	gboolean visible;
-	GtranslatorPanel *panel;
-
-	visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-
-	panel = gtranslator_window_get_side_panel (window);
-
-	if (visible)
-	{
-		gtk_widget_show (GTK_WIDGET (panel));
-		gtk_widget_grab_focus (GTK_WIDGET (panel));
-	}
-	else
-	{
-		gtk_widget_hide (GTK_WIDGET (panel));
-	}
-}

Modified: branches/GOBJECT_WORK/src/actions.h
==============================================================================
--- branches/GOBJECT_WORK/src/actions.h	(original)
+++ branches/GOBJECT_WORK/src/actions.h	Tue Jan 29 19:17:26 2008
@@ -81,9 +81,6 @@
 						 GtranslatorWindow *window);
 
 /* View */
-void       gtranslator_actions_view_show_side_pane
-						(GtkAction *action,
-						 GtranslatorWindow *window);
 
 /*Go*/
 void       gtranslator_message_go_to_first      (GtkAction  * action,

Modified: branches/GOBJECT_WORK/src/dialogs/preferences-dialog.c
==============================================================================
--- branches/GOBJECT_WORK/src/dialogs/preferences-dialog.c	(original)
+++ branches/GOBJECT_WORK/src/dialogs/preferences-dialog.c	Tue Jan 29 19:17:26 2008
@@ -456,51 +456,11 @@
 
 /***************Interface pages****************/
 
-static void
-right_radio_button_toggled(GtkToggleButton *button,
-			   GtranslatorPreferencesDialog *dlg)
-{
-	g_return_if_fail(button == GTK_TOGGLE_BUTTON(dlg->priv->right_radiobutton));
-	if(gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
-		gtranslator_prefs_manager_set_side_pane_position(FALSE);
-	else
-		gtranslator_prefs_manager_set_side_pane_position(TRUE);
-}
-
-static void
-left_radio_button_toggled(GtkToggleButton *button,
-			  GtranslatorPreferencesDialog *dlg)
-{
-	g_return_if_fail(button == GTK_TOGGLE_BUTTON(dlg->priv->left_radiobutton));
-	if(gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
-		gtranslator_prefs_manager_set_side_pane_position(TRUE);
-	else
-		gtranslator_prefs_manager_set_side_pane_position(FALSE);
-}
 
 static void
 setup_interface_pages(GtranslatorPreferencesDialog *dlg)
 {
-	gboolean pos; //FALSE: left
 	
-	/*Setup initial value*/
-	pos = gtranslator_prefs_manager_get_side_pane_position();
-	if(gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL)
-		pos = !pos;
-
-	if(pos)
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->right_radiobutton),
-					     pos);
-	else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dlg->priv->left_radiobutton),
-					  pos);
-	
-	/*Connect signals*/
-	g_signal_connect(dlg->priv->left_radiobutton, "toggled",
-			 G_CALLBACK(left_radio_button_toggled),
-			 dlg);
-	g_signal_connect(dlg->priv->right_radiobutton, "toggled",
-			 G_CALLBACK(right_radio_button_toggled),
-			 dlg);
 }
 
 static void

Modified: branches/GOBJECT_WORK/src/prefs-manager-app.c
==============================================================================
--- branches/GOBJECT_WORK/src/prefs-manager-app.c	(original)
+++ branches/GOBJECT_WORK/src/prefs-manager-app.c	Tue Jan 29 19:17:26 2008
@@ -27,6 +27,8 @@
 #endif
 
 #include <string.h>
+#include <gdl/gdl-dock-layout.h>
+#include <gdl/gdl-switcher.h>
 
 #include "prefs-manager.h"
 #include "prefs-manager-private.h"
@@ -55,6 +57,10 @@
 							       GConfEntry  *entry, 
 							       gpointer     user_data);
 
+static void gtranslator_prefs_manager_gdl_style_changed (GConfClient* client, guint id,
+							 GConfEntry* entry,
+							 gpointer user_data);
+
 /*
 static void gtranslator_prefs_manager_system_font_changed	(GConfClient *client,
 							 guint        cnxn_id,
@@ -74,7 +80,6 @@
 #define GTR_STATE_DEFAULT_WINDOW_STATE		0
 #define GTR_STATE_DEFAULT_WINDOW_WIDTH		775
 #define GTR_STATE_DEFAULT_WINDOW_HEIGHT		500
-#define GTR_STATE_DEFAULT_SIDE_PANEL_SIZE	200
 #define GTR_STATE_DEFAULT_CONTENT_PANE_POS	325
 #define GTR_STATE_DEFAULT_COMMENT_PANE_POS	525
 
@@ -84,16 +89,12 @@
 #define GTR_STATE_WINDOW_STATE "state"
 #define GTR_STATE_WINDOW_HEIGHT "height"
 #define GTR_STATE_WINDOW_WIDTH "width"
-#define GTR_STATE_SIDE_PANEL_SIZE "side_panel_size"
-#define GTR_STATE_SIDE_PANEL_ACTIVE_PAGE "side_panel_active_page"
 #define GTR_STATE_CONTENT_PANE_POS "content_pane_pos"
 #define GTR_STATE_COMMENT_PANE_POS "comment_pane_pos"
 
 static gint window_state = -1;
 static gint window_height = -1;
 static gint window_width = -1;
-static gint side_panel_size = -1;
-static gint side_panel_active_page = 0;
 static gint content_pane_pos = -1;
 static gint comment_pane_pos = -1;
 
@@ -344,79 +345,6 @@
 	return TRUE;
 }
 
-/* Side panel */
-gint
-gtranslator_prefs_manager_get_side_panel_size (void)
-{
-	if (side_panel_size == -1)
-	{
-		gtranslator_state_get_int (GTR_STATE_WINDOW_GROUP,
-				     GTR_STATE_SIDE_PANEL_SIZE,
-				     GTR_STATE_DEFAULT_SIDE_PANEL_SIZE,
-				     &side_panel_size);
-	}
-
-	return side_panel_size;
-}
-
-gint 
-gtranslator_prefs_manager_get_default_side_panel_size (void)
-{
-	return GTR_STATE_DEFAULT_SIDE_PANEL_SIZE;
-}
-
-void 
-gtranslator_prefs_manager_set_side_panel_size (gint ps)
-{
-	g_return_if_fail (ps > -1);
-	
-	if (side_panel_size == ps)
-		return;
-		
-	side_panel_size = ps;
-	gtranslator_state_set_int (GTR_STATE_WINDOW_GROUP,
-			     GTR_STATE_SIDE_PANEL_SIZE,
-			     ps);
-}
-
-gboolean 
-gtranslator_prefs_manager_side_panel_size_can_set (void)
-{
-	return TRUE;
-}
-
-gint
-gtranslator_prefs_manager_get_side_panel_active_page (void)
-{
-	if (side_panel_active_page == 0)
-	{
-		gtranslator_state_get_int (GTR_STATE_WINDOW_GROUP,
-				     GTR_STATE_SIDE_PANEL_ACTIVE_PAGE,
-				     -1,
-				     &side_panel_active_page);
-	}
-
-	return side_panel_active_page;
-}
-
-void
-gtranslator_prefs_manager_set_side_panel_active_page (gint id)
-{
-	if (side_panel_active_page == id)
-		return;
-
-	side_panel_active_page = id;
-	gtranslator_state_set_int (GTR_STATE_WINDOW_GROUP,
-				   GTR_STATE_SIDE_PANEL_ACTIVE_PAGE,
-				   id);
-}
-
-gboolean 
-gtranslator_prefs_manager_side_panel_active_page_can_set (void)
-{
-	return TRUE;
-}
-
 /* Content pane */
 gint
 gtranslator_prefs_manager_get_content_pane_pos (void)
@@ -524,18 +452,12 @@
 				GPM_VISIBLE_WHITESPACE,
 				gtranslator_prefs_manager_visible_whitespace_changed,
 				NULL, NULL, NULL);
-/*
+		
 		gconf_client_notify_add (gtranslator_prefs_manager->gconf_client,
-				GPM_SYSTEM_FONT,
-				gtranslator_prefs_manager_system_font_changed,
+				GPM_GDL_STYLE,
+				gtranslator_prefs_manager_gdl_style_changed,
 				NULL, NULL, NULL);
-
 		
-
-		gconf_client_notify_add (gtranslator_prefs_manager->gconf_client,
-				GPM_SAVE_DIR,
-				gtranslator_prefs_manager_auto_save_changed,
-				NULL, NULL, NULL);*/
 	}
 
 	return gtranslator_prefs_manager != NULL;	
@@ -702,73 +624,20 @@
 	}
 }
 
-/*
 static void
-gtranslator_prefs_manager_auto_save_changed (GConfClient *client,
-				       guint        cnxn_id,
-				       GConfEntry  *entry,
-				       gpointer     user_data)
-{
-	GList *docs;
-	GList *l;
-
-	gtranslator_debug (DEBUG_PREFS);
-
-	g_return_if_fail (entry->key != NULL);
-	g_return_if_fail (entry->value != NULL);
-
-	if (strcmp (entry->key, GPM_AUTO_SAVE) == 0)
-	{
-		gboolean auto_save;
-
-		if (entry->value->type == GCONF_VALUE_BOOL)
-			auto_save = gconf_value_get_bool (entry->value);
-		else
-			auto_save = GPM_DEFAULT_AUTO_SAVE;
-
-		docs = gtranslator_app_get_documents (gtranslator_app_get_default ());
-		l = docs;
-
-		while (l != NULL)
-		{
-			GtranslatorDocument *doc = GTR_DOCUMENT (l->data);
-			GtranslatorTab *tab = gtranslator_tab_get_from_document (doc);
-
-			gtranslator_tab_set_auto_save_enabled (tab, auto_save);
-
-			l = l->next;
-		}
-
-		g_list_free (docs);
-	}
-	else if (strcmp (entry->key,  GPM_AUTO_SAVE_INTERVAL) == 0)
-	{
-		gint auto_save_interval;
-
-		if (entry->value->type == GCONF_VALUE_INT)
-		{
-			auto_save_interval = gconf_value_get_int (entry->value);
-
-			if (auto_save_interval <= 0)
-				auto_save_interval = GPM_DEFAULT_AUTO_SAVE_INTERVAL;
-		}
-		else
-			auto_save_interval = GPM_DEFAULT_AUTO_SAVE_INTERVAL;
-
-		docs = gtranslator_app_get_documents (gtranslator_app_get_default ());
-		l = docs;
-
-		while (l != NULL)
-		{
-			GtranslatorDocument *doc = GTR_DOCUMENT (l->data);
-			GtranslatorTab *tab = gtranslator_tab_get_from_document (doc);
-
-			gtranslator_tab_set_auto_save_interval (tab, auto_save_interval);
-
-			l = l->next;
-		}
-
-		g_list_free (docs);
-	}
+gtranslator_prefs_manager_gdl_style_changed (GConfClient* client, guint id,
+					     GConfEntry* entry,
+					     gpointer user_data)
+{
+	GtranslatorWindow *window = GTR_WINDOW (user_data);
+	GdlSwitcherStyle style;
+	GdlDockLayout *layout_manager;
+	
+	style = gtranslator_prefs_manager_get_gdl_style ();
+	
+	layout_manager = GDL_DOCK_LAYOUT (_gtranslator_window_get_layout_manager (window));
+	
+	g_object_set (G_OBJECT (layout_manager->master),
+		      "switcher-style", style, NULL);
 }
-*/
+

Modified: branches/GOBJECT_WORK/src/prefs-manager.c
==============================================================================
--- branches/GOBJECT_WORK/src/prefs-manager.c	(original)
+++ branches/GOBJECT_WORK/src/prefs-manager.c	Tue Jan 29 19:17:26 2008
@@ -334,13 +334,9 @@
 		   GPM_DEFAULT_PLURALS)
 
 /* Interface */
-DEFINE_BOOL_PREF (side_pane_visible,
-		  GPM_SIDE_PANE_VISIBLE,
-		  GPM_DEFAULT_SIDE_PANE_VISIBLE)
-
-DEFINE_BOOL_PREF (side_pane_position,
-		  GPM_SIDE_PANE_POSITION,
-		  GPM_DEFAULT_SIDE_PANE_POSITION)
+DEFINE_INT_PREF (gdl_style,
+		 GPM_GDL_STYLE,
+		 GPM_DEFAULT_GDL_STYLE)
 
 /* The following functions are taken from gconf-client.c 
  * and partially modified. 

Modified: branches/GOBJECT_WORK/src/prefs-manager.h
==============================================================================
--- branches/GOBJECT_WORK/src/prefs-manager.h	(original)
+++ branches/GOBJECT_WORK/src/prefs-manager.h	Tue Jan 29 19:17:26 2008
@@ -74,8 +74,7 @@
 
 /* Interface */
 #define GPM_INTERFACE_DIR		GTR_BASE_KEY "/interface"
-#define GPM_SIDE_PANE_VISIBLE		GPM_INTERFACE_DIR "/side_pane_visible"
-#define GPM_SIDE_PANE_POSITION		GPM_INTERFACE_DIR "/side_pane_position"
+#define GPM_GDL_STYLE			GPM_INTERFACE_DIR "/gdl_style"
 
 /* Fallback default values. Keep in sync with gtranslator.schemas */
 
@@ -114,8 +113,7 @@
 #define GPM_DEFAULT_PLURALS		(const gchar*) ""
 
 /* Interface */
-#define GPM_DEFAULT_SIDE_PANE_VISIBLE	1
-#define GPM_DEFAULT_SIDE_PANE_POSITION	0 //0 Left - 1 Right
+#define GPM_DEFAULT_GDL_STYLE           2 //Both icons and text
 
 /** LIFE CYCLE MANAGEMENT FUNCTIONS **/
 
@@ -195,12 +193,8 @@
 void                     gtranslator_prefs_manager_set_number_plurals           (gint plurals);
 gint                     gtranslator_prefs_manager_get_number_plurals           (void);
 
-/* Side pane visibility */
-void			gtranslator_prefs_manager_set_side_pane_visible		(gboolean side_pane_visible);
-gboolean		gtranslator_prefs_manager_get_side_pane_visible		(void);
-
-/* Side pane position */
-void                    gtranslator_prefs_manager_set_side_pane_position        (gboolean position);
-gboolean                gtranslator_prefs_manager_get_side_pane_position        (void);
+/*gdl style*/
+void                     gtranslator_prefs_manager_set_gdl_style                (gint style);
+gint                     gtranslator_prefs_manager_get_gdl_style                (void);
 
 #endif  /* __GTR_PREFS_MANAGER_H__ */

Modified: branches/GOBJECT_WORK/src/window.c
==============================================================================
--- branches/GOBJECT_WORK/src/window.c	(original)
+++ branches/GOBJECT_WORK/src/window.c	Tue Jan 29 19:17:26 2008
@@ -37,6 +37,10 @@
 #include "egg-toolbar-editor.h"
 #include "egg-editable-toolbar.h"
 
+#include <gdl/gdl-dock.h>
+#include <gdl/gdl-dock-bar.h>
+#include <gdl/gdl-dock-layout.h>
+#include <gdl/gdl-switcher.h>
 
 #include <glib.h>
 #include <glib-object.h>
@@ -59,6 +63,7 @@
 	GtkWidget *hpaned;
 	
 	GtkWidget *menubar;
+	GtkWidget *view_menu;
 	GtkWidget *toolbar;
 	GtkActionGroup *always_sensitive_action_group;
 	GtkActionGroup *action_group;
@@ -69,6 +74,10 @@
 	GtkWidget *sidebar;
 	gint sidebar_size;
 	
+	GtkWidget *dock;
+ 	GdlDockLayout *layout_manager;
+	GHashTable *widgets;
+	
 	GtkWidget *statusbar;
 	guint generic_message_cid;
 	guint tip_message_cid;
@@ -96,8 +105,8 @@
 	{ "File", NULL, N_("_File") },
         { "Edit", NULL, N_("_Edit") },
 	{ "View", NULL, N_("_View") },
-	{ "Bookmarks", NULL, N_("_Bookmarks") },
-	{ "Actions", NULL, N_("_Actions") },
+	//{ "Bookmarks", NULL, N_("_Bookmarks") },
+	//{ "Actions", NULL, N_("_Actions") },
 	{ "Search", NULL, N_("_Search") },
         { "Go", NULL, N_("_Go") },
 	{ "Help", NULL, N_("_Help") },
@@ -180,14 +189,19 @@
 	  N_("Toggle fuzzy status of a message"),
 	  G_CALLBACK (gtranslator_message_status_toggle_fuzzy) },
 	
+	/* View menu */
+	{ "ViewSidePane", NULL, N_("Side _Pane"), "F9",
+	  N_("Show or hide the side pane in the current window"),
+	  NULL },
+	
 	/* Bookmarks menu */
-	{ "BookmarksAdd", GTK_STOCK_ADD, N_("_Add Bookmark"), "<control>D",
+	/*{ "BookmarksAdd", GTK_STOCK_ADD, N_("_Add Bookmark"), "<control>D",
           N_("Add a bookmark to the current message"), NULL},
 	{ "BookmarksEdit", GTK_STOCK_EDIT, N_("_Edit Bookmarks"), "<control>B",
-          N_("Edit stored bookmarks"), NULL},
+          N_("Edit stored bookmarks"), NULL},*/
 	
 	/* Action menu */
-	{ "ActionsCompile", GTK_STOCK_CONVERT, N_("_Compile"), NULL,
+	/*{ "ActionsCompile", GTK_STOCK_CONVERT, N_("_Compile"), NULL,
           N_("Compile the current file to a MO file"), NULL },
 	{ "ActionsRefresh", GTK_STOCK_REFRESH, NULL, NULL,
           N_("  "), NULL },
@@ -197,7 +211,7 @@
 	  //G_CALLBACK(gtranslator_auto_translation_dialog) },
 	{ "ActionsRemoveTranslations", GTK_STOCK_REMOVE, N_("Remo_ve All Translations..."), NULL,
           N_("Remove all existing translations"), NULL},
-	  //G_CALLBACK(gtranslator_remove_all_translations_dialog) },
+	  //G_CALLBACK(gtranslator_remove_all_translations_dialog) },*/
 	
         /* Go menu */
         { "GoFirst", GTK_STOCK_GOTO_FIRST, NULL, NULL,
@@ -244,11 +258,305 @@
 	
 };
 
-static const GtkToggleActionEntry toggle_entries[] = {
-	{ "ViewSidePane", NULL, N_("Side _Pane"), "F9",
-	  N_("Show or hide the side pane in the current window"),
-	  G_CALLBACK (gtranslator_actions_view_show_side_pane), FALSE }
-};
+/*
+ * Dock funcs
+ */
+static void
+on_toggle_widget_view (GtkCheckMenuItem *menuitem,
+		       GtkWidget *dockitem)
+{
+	gboolean state;
+	state = gtk_check_menu_item_get_active (menuitem);
+	if (state)
+		gdl_dock_item_show_item (GDL_DOCK_ITEM (dockitem));
+	else
+		gdl_dock_item_hide_item (GDL_DOCK_ITEM (dockitem));
+}
+
+static void
+on_update_widget_view_menuitem (gpointer key,
+				gpointer wid,
+				gpointer data)
+{
+	GtkCheckMenuItem *menuitem;
+	GdlDockItem *dockitem;
+	
+	dockitem = g_object_get_data (G_OBJECT (wid), "dockitem");
+	menuitem = g_object_get_data (G_OBJECT (wid), "menuitem");
+	
+	g_signal_handlers_block_by_func (menuitem,
+					 G_CALLBACK (on_toggle_widget_view),
+					 dockitem);
+	
+	if (GDL_DOCK_OBJECT_ATTACHED (dockitem))
+		gtk_check_menu_item_set_active (menuitem, TRUE);
+	else
+		gtk_check_menu_item_set_active (menuitem, FALSE);
+	
+	g_signal_handlers_unblock_by_func (menuitem,
+					   G_CALLBACK (on_toggle_widget_view),
+					   dockitem);
+}
+
+static void 
+on_layout_dirty_notify (GObject *object,
+			GParamSpec *pspec,
+			GtranslatorWindow *window)
+{
+	if (!strcmp (pspec->name, "dirty")) {
+		gboolean dirty;
+		g_object_get (object, "dirty", &dirty, NULL);
+		if (dirty) {
+			/* Update UI toggle buttons */
+			g_hash_table_foreach (window->priv->widgets,
+					      on_update_widget_view_menuitem,
+					      NULL);
+		}
+	}
+}
+
+static void
+gtranslator_window_layout_save (GtranslatorWindow *window,
+			const gchar *filename,
+			const gchar *name)
+{
+	g_return_if_fail (GTR_IS_WINDOW (window));
+	g_return_if_fail (filename != NULL);
+
+	gdl_dock_layout_save_layout (window->priv->layout_manager, name);
+	if (!gdl_dock_layout_save_to_file (window->priv->layout_manager, filename))
+		g_warning ("Saving dock layout to '%s' failed!", filename);
+}
+
+static void
+gtranslator_window_layout_load (GtranslatorWindow *window,
+			const gchar *layout_filename,
+			const gchar *name)
+{
+	g_return_if_fail (GTR_IS_WINDOW (window));
+
+	if (!layout_filename ||
+		!gdl_dock_layout_load_from_file (window->priv->layout_manager,
+						 layout_filename))
+	{
+		gchar *filename;
+		
+		filename = g_build_filename (DATADIR"/layout.xml", NULL);
+		//DEBUG_PRINT ("Layout = %s", filename);
+		if (!gdl_dock_layout_load_from_file (window->priv->layout_manager,
+						     filename))
+			g_warning ("Loading layout from '%s' failed!!", filename);
+		g_free (filename);
+	}
+	
+	if (!gdl_dock_layout_load_layout (window->priv->layout_manager, name))
+		g_warning ("Loading layout failed!!");
+}
+
+
+static gboolean
+remove_from_widgets_hash (gpointer name,
+			  gpointer hash_widget,
+			  gpointer widget)
+{
+	if (hash_widget == widget)
+		return TRUE;
+	return FALSE;
+}
+
+static void
+on_widget_destroy (GtkWidget *widget,
+		   GtranslatorWindow *window)
+{
+	//DEBUG_PRINT ("Widget about to be destroyed");
+	g_hash_table_foreach_remove (window->priv->widgets,
+				     remove_from_widgets_hash,
+				     widget);
+}
+
+static void
+on_widget_remove (GtkWidget *container,
+		  GtkWidget *widget,
+		  GtranslatorWindow *window)
+{
+	GtkWidget *dock_item;
+
+	dock_item = g_object_get_data (G_OBJECT (widget), "dockitem");
+	if (dock_item)
+	{
+		gchar* unique_name = g_object_get_data(G_OBJECT(dock_item), "unique_name");
+		g_free(unique_name);
+		g_signal_handlers_disconnect_by_func (G_OBJECT (dock_item),
+						      G_CALLBACK (on_widget_remove),
+						      window);
+		gdl_dock_item_unbind (GDL_DOCK_ITEM(dock_item));
+	}
+	if (g_hash_table_foreach_remove (window->priv->widgets,
+					 remove_from_widgets_hash,
+					 widget)){
+		//DEBUG_PRINT ("Widget removed from container");
+	}
+}
+
+static void
+on_widget_removed_from_hash (gpointer widget)
+{
+	GtranslatorWindow *window;
+	GtkWidget *menuitem;
+	GdlDockItem *dockitem;
+	
+	//DEBUG_PRINT ("Removing widget from hash");
+	
+	window = g_object_get_data (G_OBJECT (widget), "window-object");
+	dockitem = g_object_get_data (G_OBJECT (widget), "dockitem");
+	menuitem = g_object_get_data (G_OBJECT (widget), "menuitem");
+	
+	gtk_widget_destroy (menuitem);
+	
+	g_object_set_data (G_OBJECT (widget), "dockitem", NULL);
+	g_object_set_data (G_OBJECT (widget), "menuitem", NULL);
+
+	g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
+					      G_CALLBACK (on_widget_destroy), window);
+	g_signal_handlers_disconnect_by_func (G_OBJECT (dockitem),
+					      G_CALLBACK (on_widget_remove), window);
+	
+	g_object_unref (G_OBJECT (widget));
+}
+
+static void 
+add_widget_full (GtranslatorWindow *window, 
+		 GtkWidget *widget,
+		 const char *name,
+		 const char *title,
+		 const char *stock_id,
+		 GtranslatorWindowPlacement placement,
+		 gboolean locked,
+		 GError **error)
+{
+	GtkWidget *item;
+	GtkCheckMenuItem* menuitem;
+
+	g_return_if_fail (GTR_IS_WINDOW (window));
+	g_return_if_fail (GTK_IS_WIDGET (widget));
+	g_return_if_fail (name != NULL);
+	g_return_if_fail (title != NULL);
+
+	/* Add the widget to hash */
+	if (window->priv->widgets == NULL)
+	{
+		window->priv->widgets = g_hash_table_new_full (g_str_hash, g_str_equal,
+							       g_free,
+							       on_widget_removed_from_hash);
+	}
+	g_hash_table_insert (window->priv->widgets, g_strdup (name), widget);
+	g_object_ref (widget);
+	
+	/* Add the widget to dock */
+	if (stock_id == NULL)
+		item = gdl_dock_item_new (name, title, GDL_DOCK_ITEM_BEH_NORMAL);
+	else
+		item = gdl_dock_item_new_with_stock (name, title, stock_id,
+						     GDL_DOCK_ITEM_BEH_NORMAL);
+	if (locked)
+	{
+		guint flags = 0;
+		flags |= GDL_DOCK_ITEM_BEH_NEVER_FLOATING;
+		flags |= GDL_DOCK_ITEM_BEH_CANT_CLOSE;
+		flags |= GDL_DOCK_ITEM_BEH_CANT_ICONIFY;
+		flags |= GDL_DOCK_ITEM_BEH_NO_GRIP;
+		g_object_set(G_OBJECT(item), "behavior", flags, NULL);
+	}
+	
+	gtk_container_add (GTK_CONTAINER (item), widget);
+	gdl_dock_add_item (GDL_DOCK (window->priv->dock),
+			   GDL_DOCK_ITEM (item), placement);
+	gtk_widget_show_all (item);
+	
+	/* Add toggle button for the widget */
+	menuitem = GTK_CHECK_MENU_ITEM (gtk_check_menu_item_new_with_label (title));
+	gtk_widget_show (GTK_WIDGET (menuitem));
+	gtk_check_menu_item_set_active (menuitem, TRUE);
+	gtk_menu_append (GTK_MENU (window->priv->view_menu), GTK_WIDGET (menuitem));
+
+	if (locked)
+		g_object_set( G_OBJECT(menuitem), "visible", FALSE, NULL);
+
+	
+	g_object_set_data (G_OBJECT (widget), "window-object", window);
+	g_object_set_data (G_OBJECT (widget), "menuitem", menuitem);
+	g_object_set_data (G_OBJECT (widget), "dockitem", item);
+	
+	/* For toggling widget view on/off */
+	g_signal_connect (G_OBJECT (menuitem), "toggled",
+			  G_CALLBACK (on_toggle_widget_view), item);
+	
+	/*
+	  Watch for widget removal/destruction so that it could be
+	  removed from widgets hash.
+	*/
+	g_signal_connect (G_OBJECT (item), "remove",
+			  G_CALLBACK (on_widget_remove), window);
+	g_signal_connect_after (G_OBJECT (widget), "destroy",
+				G_CALLBACK (on_widget_destroy), window);
+}
+
+static void 
+remove_widget (GtranslatorWindow *window,
+	       GtkWidget *widget,
+	       GError **error)
+{
+	GtkWidget *dock_item;
+
+	g_return_if_fail (GTR_IS_WINDOW (window));
+	g_return_if_fail (GTK_IS_WIDGET (widget));
+
+	g_return_if_fail (window->priv->widgets != NULL);
+	
+	dock_item = g_object_get_data (G_OBJECT (widget), "dockitem");
+	g_return_if_fail (dock_item != NULL);
+	
+	/* Remove the widget from container */
+	g_object_ref (widget);
+	/* It should call on_widget_remove() and clean up should happen */
+	gtk_container_remove (GTK_CONTAINER (dock_item), widget);
+	g_object_unref (widget);
+}
+
+static void 
+gtranslator_app_present_widget (GtranslatorWindow *window,
+			   GtkWidget *widget,
+			   GError **error)
+{
+	GdlDockItem *dock_item;
+	GtkWidget *parent;
+	
+	g_return_if_fail (GTR_IS_WINDOW (window));
+	g_return_if_fail (GTK_IS_WIDGET (widget));
+	
+	g_return_if_fail (window->priv->widgets != NULL);
+	
+	dock_item = g_object_get_data (G_OBJECT(widget), "dockitem");
+	g_return_if_fail (dock_item != NULL);
+	
+	/* Hack to present the dock item if it's in a notebook dock item */
+	parent = gtk_widget_get_parent (GTK_WIDGET(dock_item) );
+	if (GTK_IS_NOTEBOOK (parent))
+	{
+		gint pagenum;
+		pagenum = gtk_notebook_page_num (GTK_NOTEBOOK (parent), GTK_WIDGET (dock_item));
+		gtk_notebook_set_current_page (GTK_NOTEBOOK (parent), pagenum);
+	} 
+	else if (!GDL_DOCK_OBJECT_ATTACHED (dock_item)) 
+	{ 
+	    gdl_dock_item_show_item (GDL_DOCK_ITEM (dock_item));  
+	}
+	
+	/* FIXME: If the item is floating, present the window */
+	/* FIXME: There is no way to detect if a widget was floating before it was
+	detached since it no longer has a parent there is no way to access the
+	floating property of the GdlDock structure.*/
+}
 
 void
 set_sensitive_according_to_message(GtranslatorWindow *window,
@@ -867,7 +1175,8 @@
 	GtkWidget *hbox; //Statusbar and progressbar
 	GtkWidget *widget;
 	GError *error = NULL;
-	gint table_pane_position;
+	GtkWidget *dockbar;
+	GtkWidget *hbox_dock;
 	
 	GtranslatorWindowPrivate *priv = window->priv;
 	
@@ -893,9 +1202,6 @@
 				      G_N_ELEMENTS(always_sensitive_entries),
 				      window);
 
-	gtk_action_group_add_toggle_actions (priv->always_sensitive_action_group, toggle_entries,
-				      G_N_ELEMENTS (toggle_entries), window);
-
 	gtk_ui_manager_insert_action_group (priv->ui_manager,
 					    priv->always_sensitive_action_group, 0);
 	
@@ -921,7 +1227,9 @@
 			    priv->menubar,
 			    FALSE, FALSE, 0);
 	
-	/* recent files */	
+	/*
+	 * Recent files 
+	 */	
 	priv->recent_manager = gtk_recent_manager_get_default();
 
 	priv->recent_menu = create_recent_chooser_menu (window, priv->recent_manager);
@@ -952,44 +1260,32 @@
 			    FALSE, FALSE, 0);
 	gtk_widget_show (priv->toolbar);
 	
-	
 	/*
-	 * hpaned
+	 * Docker
 	 */
-	priv->hpaned = gtk_hpaned_new ();
-	g_signal_connect (priv->hpaned,
-			  "notify::position",
-			  G_CALLBACK (window_sidebar_position_change_cb),
-			  window);
-	
-	gtk_paned_set_position (GTK_PANED (priv->hpaned),
-				gtranslator_prefs_manager_get_side_panel_size());
-	
-	gtk_box_pack_start (GTK_BOX (priv->main_box), priv->hpaned,
-			    TRUE, TRUE, 0);
-	gtk_widget_show (priv->hpaned);
-	
+	hbox = gtk_hbox_new (FALSE, 0);
+	priv->dock = gdl_dock_new ();
+	gtk_widget_show (priv->dock);
+	gtk_box_pack_end(GTK_BOX (hbox),
+			   priv->dock, TRUE, TRUE, 0);
+	
+	dockbar = gdl_dock_bar_new (GDL_DOCK(priv->dock));
+	gtk_widget_show (dockbar);
+	gtk_box_pack_start (GTK_BOX (hbox),
+			    dockbar, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (priv->main_box),
+			    hbox, TRUE, TRUE, 0);
+	gtk_widget_show (hbox);
 	
-	/*
-	 * sidebar
-	 */
-	priv->sidebar = gtranslator_panel_new(GTK_ORIENTATION_VERTICAL);
-	if(!gtranslator_prefs_manager_get_side_pane_position())
-		gtk_paned_pack1(GTK_PANED(priv->hpaned), priv->sidebar, FALSE, FALSE);
-	else gtk_paned_pack2(GTK_PANED(priv->hpaned), priv->sidebar, FALSE, FALSE);
-
-	g_signal_connect_after (priv->sidebar,
-				"show",
-				G_CALLBACK (side_pane_visibility_changed),
-				window);
-	g_signal_connect_after (priv->sidebar,
-				"hide",
-				G_CALLBACK (side_pane_visibility_changed),
-				window);
-
-	if (gtranslator_prefs_manager_get_side_pane_visible ())
-		gtk_widget_show(priv->sidebar);
-
+	priv->layout_manager = gdl_dock_layout_new (GDL_DOCK (priv->dock));
+	g_object_set (priv->layout_manager->master,
+		      "switcher-style",
+		      gtranslator_prefs_manager_get_gdl_style (),
+		      NULL);
+	g_signal_connect (priv->layout_manager,
+			  "notify::dirty",
+			  G_CALLBACK (on_layout_dirty_notify),
+			  window);
 
 	/*
 	 * notebook
@@ -1003,13 +1299,6 @@
 			  "tab_close_request",
 			  G_CALLBACK (notebook_tab_close_request),
 			  window);
-	
-	if(!gtranslator_prefs_manager_get_side_pane_position())
-		gtk_paned_pack2(GTK_PANED(priv->hpaned), priv->notebook, FALSE, FALSE);
-	else gtk_paned_pack1(GTK_PANED(priv->hpaned), priv->notebook, FALSE, FALSE);
-	gtk_widget_show(priv->notebook);
-
-
 	/*
 	 * hbox
 	 */
@@ -1048,6 +1337,8 @@
 {
 	GtkTargetList *tl;
 	gint active_page;
+	GtkWidget *view_menu;
+	gchar *filename;
 	
 	window->priv = GTR_WINDOW_GET_PRIVATE (window);
 	
@@ -1086,15 +1377,40 @@
 	                  NULL);
 
 	/*
+	 * Create widgets menu 
+	 */
+	view_menu = 
+		gtk_ui_manager_get_widget (window->priv->ui_manager,
+					   "/MainMenu/ViewMenu");
+	window->priv->view_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (view_menu));
+	
+	/*
 	 * Plugins
 	 */
 	gtranslator_plugins_engine_update_plugins_ui (gtranslator_plugins_engine_get_default (),
 						window, TRUE);
-						
-	/*We have to active the right tab after plugins load*/
-	active_page = gtranslator_prefs_manager_get_side_panel_active_page ();
-	_gtranslator_panel_set_active_item_by_id (GTR_PANEL (window->priv->sidebar),
-					    active_page);
+	
+	/*
+	 * Adding notebook to dock
+	 */
+	add_widget_full (window,
+			 window->priv->notebook,
+			 "GtranslatorNotebook",
+			 _("Documents"),
+			 NULL,
+			 GTR_WINDOW_PLACEMENT_CENTER,
+			 TRUE,
+			 NULL);
+	
+	/*
+	 * Loading dock layout
+	 */
+	filename = g_strdup_printf ("%s/.config/gtranslator-layout.xml",
+				    g_get_home_dir());
+	gtranslator_window_layout_load (window,
+					filename,
+					NULL);
+	g_free (filename);
 }
 
 static void
@@ -1126,7 +1442,7 @@
 static void
 save_panes_state(GtranslatorWindow *window)
 {
-	gint pane_page;
+	gchar *filename;
 
         if (gtranslator_prefs_manager_window_size_can_set ())
         	gtranslator_prefs_manager_set_window_size (window->priv->width,
@@ -1135,15 +1451,10 @@
         if (gtranslator_prefs_manager_window_state_can_set ())
 		gtranslator_prefs_manager_set_window_state (window->priv->window_state);
 
-        if ((window->priv->sidebar_size > 0) &&
-	    gtranslator_prefs_manager_side_panel_size_can_set ())
-		gtranslator_prefs_manager_set_side_panel_size (
-                                        window->priv->sidebar_size);
-
-	pane_page = _gtranslator_panel_get_active_item_id (GTR_PANEL (window->priv->sidebar));
-	if (pane_page != 0 &&
-	    gtranslator_prefs_manager_side_panel_active_page_can_set ())
-		gtranslator_prefs_manager_set_side_panel_active_page (pane_page);
+	filename = g_strdup_printf ("%s/.config/gtranslator-layout.xml",
+				    g_get_home_dir());
+        gtranslator_window_layout_save (window,
+					filename, NULL);
 }
 
 static void
@@ -1370,3 +1681,33 @@
 					      percentage);
 	}
 }
+
+void
+gtranslator_window_add_widget (GtranslatorWindow *window,
+			       GtkWidget *widget,
+			       const gchar *name,
+			       const gchar *title,
+			       const gchar *stock_id,
+			       GtranslatorWindowPlacement placement)
+{
+	/*FIXME: We have to manage the error*/
+	add_widget_full (window, widget,
+			 name, title, stock_id,
+			 placement, FALSE, NULL);
+}
+
+void
+gtranslator_window_remove_widget (GtranslatorWindow *window,
+				  GtkWidget *widget)
+{
+	/*FIXME: We have to manage the error*/
+	remove_widget (window, widget, NULL);
+}
+
+GObject *
+_gtranslator_window_get_layout_manager (GtranslatorWindow *window)
+{
+	g_return_val_if_fail (GTR_IS_WINDOW (window), NULL);
+	
+	return G_OBJECT (window->priv->layout_manager);
+}

Modified: branches/GOBJECT_WORK/src/window.h
==============================================================================
--- branches/GOBJECT_WORK/src/window.h	(original)
+++ branches/GOBJECT_WORK/src/window.h	Tue Jan 29 19:17:26 2008
@@ -67,6 +67,17 @@
 	GtkWindowClass parent_class;
 };
 
+typedef enum
+{
+	GTR_WINDOW_PLACEMENT_NONE = 0,
+	GTR_WINDOW_PLACEMENT_TOP,
+	GTR_WINDOW_PLACEMENT_BOTTOM,
+	GTR_WINDOW_PLACEMENT_RIGHT,
+	GTR_WINDOW_PLACEMENT_LEFT,
+	GTR_WINDOW_PLACEMENT_CENTER,
+	GTR_WINDOW_PLACEMENT_FLOATING
+} GtranslatorWindowPlacement;
+
 /*
  * Public methods
  */
@@ -86,8 +97,6 @@
 GtranslatorHeader
 		*gtranslator_window_get_header_from_active_tab (GtranslatorWindow *window);
 
-GtranslatorPanel *gtranslator_window_get_side_panel   (GtranslatorWindow *window);
-
 GtkStatusbar 	 *gtranslator_window_get_statusbar    (GtranslatorWindow *window);
 
 GtkUIManager     *gtranslator_window_get_ui_manager   (GtranslatorWindow *window);
@@ -108,6 +117,19 @@
 
 void              set_sensitive_according_to_window   (GtranslatorWindow *window);
 
+void              gtranslator_window_add_widget       (GtranslatorWindow *window,
+						       GtkWidget *widget,
+						       const gchar *name,
+						       const gchar *title,
+						       const gchar *stock_id,
+						       GtranslatorWindowPlacement placement);
+
+void              gtranslator_window_remove_widget    (GtranslatorWindow *window,
+						       GtkWidget *widget);
+
+GObject *        _gtranslator_window_get_layout_manager
+						      (GtranslatorWindow *window);
+
 G_END_DECLS
 
 #endif /* __WINDOW_H__ */



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