[gtranslator] Make the translation memory always visible. Fixes bug #610986.



commit bccd9daadfccc3fe6d3f14aecae92055f5ea1967
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sat Apr 17 15:24:39 2010 +0200

    Make the translation memory always visible. Fixes bug #610986.
    
    Make the context pane full height. So it is visible the translation
    memory and the context at the same time.

 data/gtranslator-ui.xml                            |    1 -
 .../gtr-alternate-language-plugin.c                |    2 +-
 src/gtr-actions-view.c                             |   12 --
 src/gtr-actions.h                                  |    3 -
 src/gtr-prefs-manager-app.c                        |   32 +++---
 src/gtr-prefs-manager-app.h                        |    6 +-
 src/gtr-tab.c                                      |  119 ++++++++------------
 src/gtr-tab.h                                      |    2 -
 src/gtr-window.c                                   |    3 -
 9 files changed, 68 insertions(+), 112 deletions(-)
---
diff --git a/data/gtranslator-ui.xml b/data/gtranslator-ui.xml
index c78c242..addb6fa 100644
--- a/data/gtranslator-ui.xml
+++ b/data/gtranslator-ui.xml
@@ -39,7 +39,6 @@
       <placeholder name="ViewOps_1" />
       <separator/>
       <menuitem name="ViewContextMenu" action="ViewContext"/>
-      <menuitem name="ViewTranslationMemoryMenu" action="ViewTranslationMemory"/>
       <placeholder name="ViewOps_2" />
       <separator/>
     </menu>
diff --git a/plugins/alternate-language/gtr-alternate-language-plugin.c b/plugins/alternate-language/gtr-alternate-language-plugin.c
index 4b2ece3..924269b 100644
--- a/plugins/alternate-language/gtr-alternate-language-plugin.c
+++ b/plugins/alternate-language/gtr-alternate-language-plugin.c
@@ -55,7 +55,7 @@ on_alternate_lang_activated (GtkAction *action,
 }
 
 static const GtkActionEntry action_entries[] = {
-  {"AlternateLang", NULL, N_("_Alternate Language"), "<control>L",
+  {"AlternateLang", NULL, N_("_Alternate Language"), "<control>K",
    N_("Show the Alternate Language panel"),
    G_CALLBACK (on_alternate_lang_activated)},
 };
diff --git a/src/gtr-actions-view.c b/src/gtr-actions-view.c
index 262e08c..5ebde71 100644
--- a/src/gtr-actions-view.c
+++ b/src/gtr-actions-view.c
@@ -28,15 +28,3 @@ gtr_actions_view_context (GtkAction * action, GtrWindow * window)
 
   gtr_tab_show_lateral_panel_widget (tab, context);
 }
-
-void
-gtr_actions_view_translation_memory (GtkAction * action, GtrWindow * window)
-{
-  GtrTab *tab;
-  GtkWidget *tm_ui;
-
-  tab = gtr_window_get_active_tab (window);
-  tm_ui = GTK_WIDGET (gtr_tab_get_translation_memory_ui (tab));
-
-  gtr_tab_show_lateral_panel_widget (tab, tm_ui);
-}
diff --git a/src/gtr-actions.h b/src/gtr-actions.h
index 0c33d00..896433c 100644
--- a/src/gtr-actions.h
+++ b/src/gtr-actions.h
@@ -71,9 +71,6 @@ void gtr_actions_edit_clear (GtkAction * action, GtrWindow * window);
 /* View */
 void gtr_actions_view_context (GtkAction * action, GtrWindow * window);
 
-void gtr_actions_view_translation_memory
-  (GtkAction * action, GtrWindow * window);
-
 /*Go*/
 void gtr_message_go_to_first (GtkAction * action, GtrWindow * window);
 
diff --git a/src/gtr-prefs-manager-app.c b/src/gtr-prefs-manager-app.c
index e2ec0a9..e4dfb3d 100644
--- a/src/gtr-prefs-manager-app.c
+++ b/src/gtr-prefs-manager-app.c
@@ -91,7 +91,7 @@ static void gtr_prefs_manager_scheme_color_changed (GConfClient *
 #define GTR_STATE_DEFAULT_WINDOW_WIDTH		775
 #define GTR_STATE_DEFAULT_WINDOW_HEIGHT		500
 #define GTR_STATE_DEFAULT_CONTENT_PANE_POS	325
-#define GTR_STATE_DEFAULT_COMMENT_PANE_POS	525
+#define GTR_STATE_DEFAULT_CONTEXT_PANE_POS	525
 
 #define GTR_STATE_FILE_NAME "gtranslator.config"
 
@@ -100,13 +100,13 @@ static void gtr_prefs_manager_scheme_color_changed (GConfClient *
 #define GTR_STATE_WINDOW_HEIGHT "height"
 #define GTR_STATE_WINDOW_WIDTH "width"
 #define GTR_STATE_CONTENT_PANE_POS "content_pane_pos"
-#define GTR_STATE_COMMENT_PANE_POS "comment_pane_pos"
+#define GTR_STATE_CONTEXT_PANE_POS "context_pane_pos"
 
 static gint window_state = -1;
 static gint window_height = -1;
 static gint window_width = -1;
 static gint content_pane_pos = -1;
-static gint comment_pane_pos = -1;
+static gint context_pane_pos = -1;
 
 static GKeyFile *
 get_gtr_state_file ()
@@ -343,38 +343,38 @@ gtr_prefs_manager_set_content_pane_pos (gint new_pane_pos)
                      GTR_STATE_CONTENT_PANE_POS, new_pane_pos);
 }
 
-/* Comment pane */
+/* Context pane */
 gint
-gtr_prefs_manager_get_comment_pane_pos (void)
+gtr_prefs_manager_get_context_pane_pos (void)
 {
-  if (comment_pane_pos == -1)
+  if (context_pane_pos == -1)
     {
       gtr_state_get_int (GTR_STATE_WINDOW_GROUP,
-                         GTR_STATE_COMMENT_PANE_POS,
-                         GTR_STATE_DEFAULT_COMMENT_PANE_POS,
-                         &comment_pane_pos);
+                         GTR_STATE_CONTEXT_PANE_POS,
+                         GTR_STATE_DEFAULT_CONTEXT_PANE_POS,
+                         &context_pane_pos);
     }
 
-  return comment_pane_pos;
+  return context_pane_pos;
 }
 
 gint
-gtr_prefs_manager_get_default_comment_pane_pos (void)
+gtr_prefs_manager_get_default_context_pane_pos (void)
 {
-  return GTR_STATE_DEFAULT_COMMENT_PANE_POS;
+  return GTR_STATE_DEFAULT_CONTEXT_PANE_POS;
 }
 
 void
-gtr_prefs_manager_set_comment_pane_pos (gint new_pane_pos)
+gtr_prefs_manager_set_context_pane_pos (gint new_pane_pos)
 {
   g_return_if_fail (new_pane_pos > -1);
 
-  if (comment_pane_pos == new_pane_pos)
+  if (context_pane_pos == new_pane_pos)
     return;
 
-  comment_pane_pos = new_pane_pos;
+  context_pane_pos = new_pane_pos;
   gtr_state_set_int (GTR_STATE_WINDOW_GROUP,
-                     GTR_STATE_COMMENT_PANE_POS, new_pane_pos);
+                     GTR_STATE_CONTEXT_PANE_POS, new_pane_pos);
 }
 
 /* Normal prefs are stored in GConf */
diff --git a/src/gtr-prefs-manager-app.h b/src/gtr-prefs-manager-app.h
index 907c83a..b088e99 100644
--- a/src/gtr-prefs-manager-app.h
+++ b/src/gtr-prefs-manager-app.h
@@ -57,9 +57,9 @@ void gtr_prefs_manager_set_side_panel_active_page (gint id);
 gboolean gtr_prefs_manager_side_panel_active_page_can_set (void);
 
 /* Comment pane */
-gint gtr_prefs_manager_get_comment_pane_pos (void);
-gint gtr_prefs_manager_get_default_comment_pane_pos (void);
-void gtr_prefs_manager_set_comment_pane_pos (gint new_pane_pos);
+gint gtr_prefs_manager_get_context_pane_pos (void);
+gint gtr_prefs_manager_get_default_context_pane_pos (void);
+void gtr_prefs_manager_set_context_pane_pos (gint new_pane_pos);
 
 /* Content pane */
 gint gtr_prefs_manager_get_content_pane_pos (void);
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index 1226255..d5e53e1 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -68,11 +68,10 @@ struct _GtrTabPrivate
 
   GtkWidget *table_pane;
   GtkWidget *content_pane;
-  GtkWidget *panel;
   GtkWidget *message_table;
   GtkWidget *lateral_panel;        //TM, Context, etc.
 
-  GtkWidget *comment_pane;
+  GtkWidget *context_pane;
   GtkWidget *context;
   GtkWidget *translation_memory;
 
@@ -497,11 +496,10 @@ update_status (GtrTab * tab, GtrMsg * msg, gpointer useless)
 }
 
 static void
-comment_pane_position_changed (GObject * tab_gobject,
+context_pane_position_changed (GObject * tab_gobject,
                                GParamSpec * arg1, GtrTab * tab)
 {
-  gtr_prefs_manager_set_comment_pane_pos (gtk_paned_get_position
-                                          (GTK_PANED (tab_gobject)));
+  gtr_prefs_manager_set_context_pane_pos (gtk_paned_get_position (GTK_PANED (tab_gobject)));
 }
 
 static void
@@ -564,53 +562,11 @@ static void
 gtr_tab_draw (GtrTab * tab)
 {
   GtkWidget *vertical_box;
-  GtkWidget *label_widget;
+  GtkWidget *vcontext_box;
   GtkWidget *msgid_label;
   GtkWidget *scroll;
   GtrTabPrivate *priv = tab->priv;
 
-  /* Panel */
-  priv->panel = gtk_notebook_new ();
-  gtk_notebook_set_tab_pos (GTK_NOTEBOOK (priv->panel), GTK_POS_BOTTOM);
-  gtk_widget_show (priv->panel);
-
-  /* Message table */
-  priv->message_table = gtr_message_table_new (GTK_WIDGET (tab));
-  gtk_widget_show (priv->message_table);
-
-  label_widget = gtk_label_new (_("Message Table"));
-
-  gtk_notebook_append_page (GTK_NOTEBOOK (priv->panel),
-                            priv->message_table, label_widget);
-
-  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->panel), FALSE);
-
-  /* Comment pane */
-  priv->comment_pane = gtk_hpaned_new ();
-  gtk_paned_set_position (GTK_PANED (priv->comment_pane),
-                          gtr_prefs_manager_get_comment_pane_pos ());
-  g_signal_connect (priv->comment_pane, "notify::position",
-                    G_CALLBACK (comment_pane_position_changed), tab);
-  gtk_widget_show (priv->comment_pane);
-
-  /* Lateral panel */
-  tab->priv->lateral_panel = gtk_notebook_new ();
-  gtk_widget_show (tab->priv->lateral_panel);
-
-  gtk_paned_pack2 (GTK_PANED (priv->comment_pane), tab->priv->lateral_panel,
-                   TRUE, TRUE);
-
-  /* Context */
-  priv->context = gtr_context_panel_new (GTK_WIDGET (tab));
-  gtk_widget_show (priv->context);
-  gtr_tab_add_widget_to_lateral_panel (tab, priv->context, _("Context"));
-
-  /* TM */
-  priv->translation_memory = gtr_translation_memory_ui_new (GTK_WIDGET (tab));
-  gtk_widget_show (priv->translation_memory);
-  gtr_tab_add_widget_to_lateral_panel (tab, priv->translation_memory,
-                                       _("Translation Memory"));
-
   /* Content pane; this is where the message table and message area go */
   priv->content_pane = gtk_vpaned_new ();
   gtk_paned_set_position (GTK_PANED (priv->content_pane),
@@ -620,13 +576,12 @@ gtr_tab_draw (GtrTab * tab)
                     G_CALLBACK (content_pane_position_changed), tab);
   gtk_widget_show (priv->content_pane);
 
-  /* Pack the comments pane and the main content */
-  vertical_box = gtk_vbox_new (FALSE, 0);
-  gtk_paned_pack1 (GTK_PANED (priv->content_pane), GTK_WIDGET (priv->panel),
+  /* Message table */
+  priv->message_table = gtr_message_table_new (GTK_WIDGET (tab));
+  gtk_widget_show (priv->message_table);
+
+  gtk_paned_pack1 (GTK_PANED (priv->content_pane), GTK_WIDGET (priv->message_table),
                    TRUE, FALSE);
-  gtk_paned_pack2 (GTK_PANED (priv->content_pane), priv->comment_pane, FALSE,
-                   TRUE);
-  gtk_widget_show (vertical_box);
 
   /* Orignal text widgets */
   priv->msgid_hbox = gtk_hbox_new (FALSE, 0);
@@ -681,6 +636,9 @@ gtr_tab_draw (GtrTab * tab)
   gtk_box_pack_start (GTK_BOX (priv->text_vbox), priv->text_plural_scroll,
                       TRUE, TRUE, 0);
 
+  vertical_box = gtk_vbox_new (FALSE, 0);
+  gtk_widget_show (vertical_box);
+
   gtk_box_pack_start (GTK_BOX (vertical_box), priv->msgid_hbox, FALSE, FALSE,
                       0);
   gtk_box_pack_start (GTK_BOX (vertical_box), priv->text_vbox, TRUE, TRUE, 0);
@@ -703,10 +661,43 @@ gtr_tab_draw (GtrTab * tab)
   gtk_box_pack_start (GTK_BOX (vertical_box), priv->trans_notebook, TRUE,
                       TRUE, 0);
 
-  gtk_paned_pack1 (GTK_PANED (priv->comment_pane), vertical_box, FALSE,
-                   FALSE);
+  gtk_paned_pack2 (GTK_PANED (priv->content_pane), vertical_box, FALSE,
+                   TRUE);
+
+  /* Context pane */
+  priv->context_pane = gtk_hpaned_new ();
+  gtk_paned_set_position (GTK_PANED (priv->context_pane),
+                          gtr_prefs_manager_get_context_pane_pos ());
+  g_signal_connect (priv->context_pane, "notify::position",
+                    G_CALLBACK (context_pane_position_changed), tab);
+  gtk_widget_show (priv->context_pane);
+
+  gtk_paned_pack1 (GTK_PANED (priv->context_pane), priv->content_pane,
+                   FALSE, TRUE);
+  gtk_box_pack_start (GTK_BOX (tab), priv->context_pane, TRUE, TRUE, 0);
+
+  /* Vertical context box (TM, context etc ) */
+  vcontext_box = gtk_vbox_new (FALSE, 6);
+  gtk_widget_show (vcontext_box);
+  gtk_paned_pack2 (GTK_PANED (priv->context_pane), vcontext_box,
+                   TRUE, TRUE);
+
+  /* TM */
+  priv->translation_memory = gtr_translation_memory_ui_new (GTK_WIDGET (tab));
+  gtk_widget_show (priv->translation_memory);
+  gtk_box_pack_start (GTK_BOX (vcontext_box), priv->translation_memory,
+                      TRUE, TRUE, 0);
+
+  /* Lateral panel */
+  tab->priv->lateral_panel = gtk_notebook_new ();
+  gtk_widget_show (tab->priv->lateral_panel);
+  gtk_box_pack_start (GTK_BOX (vcontext_box), tab->priv->lateral_panel,
+                      TRUE, TRUE, 0);
 
-  gtk_box_pack_start (GTK_BOX (tab), priv->content_pane, TRUE, TRUE, 0);
+  /* Context */
+  priv->context = gtr_context_panel_new (GTK_WIDGET (tab));
+  gtk_widget_show (priv->context);
+  gtr_tab_add_widget_to_lateral_panel (tab, priv->context, _("Context"));
 }
 
 static void
@@ -909,20 +900,6 @@ gtr_tab_get_po (GtrTab * tab)
 }
 
 /**
- * gtr_tab_get_panel:
- * @tab: a #GtranslationTab
- * 
- * Return value: the horizontal notebook of the #GtranslationTab
-**/
-GtkWidget *
-gtr_tab_get_panel (GtrTab * tab)
-{
-  g_return_val_if_fail (tab != NULL, NULL);
-
-  return tab->priv->panel;
-}
-
-/**
  * gtr_tab_get_active_trans_tab:
  * @tab: a #GtranslationTab
  * 
diff --git a/src/gtr-tab.h b/src/gtr-tab.h
index 0937c2d..3cb96f7 100644
--- a/src/gtr-tab.h
+++ b/src/gtr-tab.h
@@ -88,8 +88,6 @@ GtrTab *gtr_tab_new (GtrPo * po);
 
 GtrPo *gtr_tab_get_po (GtrTab * tab);
 
-GtkWidget *gtr_tab_get_panel (GtrTab * tab);
-
 gint gtr_tab_get_active_trans_tab (GtrTab * tab);
 
 GtrContextPanel *gtr_tab_get_context_panel (GtrTab * tab);
diff --git a/src/gtr-window.c b/src/gtr-window.c
index 2d8c48c..a3b807d 100644
--- a/src/gtr-window.c
+++ b/src/gtr-window.c
@@ -207,9 +207,6 @@ static const GtkActionEntry entries[] = {
   {"ViewContext", NULL, N_("_Context"), "<control>J",
    N_("Show the Context panel"),
    G_CALLBACK (gtr_actions_view_context)},
-  {"ViewTranslationMemory", NULL, N_("_Translation Memory"), "<control>K",
-   N_("Show the Translation Memory panel"),
-   G_CALLBACK (gtr_actions_view_translation_memory)},
 
   /* Go menu */
   {"GoPrevious", GTK_STOCK_GO_BACK, N_("_Previous Message"),



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