[gtranslator] Moved *_draw methods to *_init
- From: Daniel Mustieles GarcÃa <dmustieles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] Moved *_draw methods to *_init
- Date: Sat, 21 Apr 2012 11:52:17 +0000 (UTC)
commit c1232fb3da560b24e9bc25b187127adf668078b0
Author: Daniel Mustieles <daniel mustieles gmail com>
Date: Sat Apr 21 13:33:21 2012 +0200
Moved *_draw methods to *_init
.../gtr-alternate-language-panel.c | 23 ++--
plugins/dictionary/gtr-dict-panel.c | 132 +++++++++----------
plugins/glossary/glossary-panel.c | 6 +-
plugins/open-tran/gtr-open-tran-panel.c | 22 ++--
src/gtr-message-table.c | 27 ++---
src/gtr-tab.c | 68 +++++------
src/gtr-window.c | 95 +++++++--------
7 files changed, 166 insertions(+), 207 deletions(-)
---
diff --git a/plugins/alternate-language/gtr-alternate-language-panel.c b/plugins/alternate-language/gtr-alternate-language-panel.c
index 3de6ad1..f09cb1e 100644
--- a/plugins/alternate-language/gtr-alternate-language-panel.c
+++ b/plugins/alternate-language/gtr-alternate-language-panel.c
@@ -295,12 +295,20 @@ copy_button_clicked_cb (GtkWidget *copy_button,
}
static void
-gtr_alternate_lang_panel_draw (GtrAlternateLangPanel * panel)
+gtr_alternate_lang_panel_init (GtrAlternateLangPanel * panel)
{
GtkWidget *hbox;
GtkWidget *buttonbox;
GtkWidget *scroll;
+ panel->priv = GTR_ALTERNATE_LANG_PANEL_GET_PRIVATE (panel);
+
+ panel->priv->showed_message_id = 0;
+ panel->priv->po = NULL;
+
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
+ GTK_ORIENTATION_VERTICAL);
+
/* Hbox */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show (hbox);
@@ -362,20 +370,7 @@ gtr_alternate_lang_panel_draw (GtrAlternateLangPanel * panel)
GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (panel), scroll, TRUE, TRUE, 0);
-}
-
-static void
-gtr_alternate_lang_panel_init (GtrAlternateLangPanel * panel)
-{
- panel->priv = GTR_ALTERNATE_LANG_PANEL_GET_PRIVATE (panel);
-
- panel->priv->showed_message_id = 0;
- panel->priv->po = NULL;
-
- gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
- GTK_ORIENTATION_VERTICAL);
- gtr_alternate_lang_panel_draw (panel);
}
static void
diff --git a/plugins/dictionary/gtr-dict-panel.c b/plugins/dictionary/gtr-dict-panel.c
index a399d8d..13eae52 100644
--- a/plugins/dictionary/gtr-dict-panel.c
+++ b/plugins/dictionary/gtr-dict-panel.c
@@ -423,11 +423,73 @@ gtr_dict_panel_link_clicked (GtkWidget * defbox,
}
static void
-gtr_dict_panel_draw (GtrDictPanel * panel)
+on_settings_changed (GSettings *settings,
+ const gchar *key,
+ GtrDictPanel *panel)
{
+ if (strcmp (key, DICTIONARY_SETTINGS_SOURCE_KEY) == 0)
+ {
+ gchar *source_name;
+
+ source_name = g_settings_get_string (settings, key);
+ gtr_dict_panel_set_source_name (panel, source_name);
+
+ g_free (source_name);
+ }
+ else if (strcmp (key, DICTIONARY_SETTINGS_DATABASE_KEY) == 0)
+ {
+ gchar *database;
+
+ database = g_settings_get_string (settings, key);
+ gtr_dict_panel_set_database (panel, database);
+
+ g_free (database);
+ }
+ else if (strcmp (key, DICTIONARY_SETTINGS_STRATEGY_KEY) == 0)
+ {
+ gchar *strategy;
+
+ strategy = g_settings_get_string (settings, key);
+ gtr_dict_panel_set_strategy (panel, strategy);
+
+ g_free (strategy);
+ }
+}
+
+static void
+gtr_dict_panel_init (GtrDictPanel * panel)
+{
+ GtrDictPanelPrivate *priv;
GtkWidget *vbox;
GtkWidget *hbox;
+ panel->priv = GTR_DICT_PANEL_GET_PRIVATE (panel);
+ priv = panel->priv;
+
+ priv->status = NULL;
+
+ if (!priv->loader)
+ panel->priv->loader = gdict_source_loader_new ();
+
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
+ GTK_ORIENTATION_VERTICAL);
+
+ /* add our data dir inside $HOME to the loader's search paths */
+ gdict_source_loader_add_search_path (priv->loader,
+ gtr_dirs_get_user_config_dir ());
+
+ /* settings */
+ priv->settings = g_settings_new ("org.gnome.gtranslator.plugins.dictionary");
+
+ g_signal_connect (priv->settings,
+ "changed",
+ G_CALLBACK (on_settings_changed),
+ panel);
+
+ /* force retrieval of the configuration from gsettings */
+ gtr_dict_panel_set_source_name (panel, NULL);
+
+ /* Draw widgets */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_widget_show (vbox);
@@ -536,75 +598,7 @@ gtr_dict_panel_draw (GtrDictPanel * panel)
gtk_widget_show (panel->priv->source_chooser);
gtk_widget_show (panel->priv->sidebar);
-}
-
-static void
-on_settings_changed (GSettings *settings,
- const gchar *key,
- GtrDictPanel *panel)
-{
- if (strcmp (key, DICTIONARY_SETTINGS_SOURCE_KEY) == 0)
- {
- gchar *source_name;
-
- source_name = g_settings_get_string (settings, key);
- gtr_dict_panel_set_source_name (panel, source_name);
-
- g_free (source_name);
- }
- else if (strcmp (key, DICTIONARY_SETTINGS_DATABASE_KEY) == 0)
- {
- gchar *database;
-
- database = g_settings_get_string (settings, key);
- gtr_dict_panel_set_database (panel, database);
-
- g_free (database);
- }
- else if (strcmp (key, DICTIONARY_SETTINGS_STRATEGY_KEY) == 0)
- {
- gchar *strategy;
-
- strategy = g_settings_get_string (settings, key);
- gtr_dict_panel_set_strategy (panel, strategy);
-
- g_free (strategy);
- }
-}
-static void
-gtr_dict_panel_init (GtrDictPanel * panel)
-{
- GtrDictPanelPrivate *priv;
-
- panel->priv = GTR_DICT_PANEL_GET_PRIVATE (panel);
- priv = panel->priv;
-
- priv->status = NULL;
-
- if (!priv->loader)
- panel->priv->loader = gdict_source_loader_new ();
-
- gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
- GTK_ORIENTATION_VERTICAL);
-
- /* add our data dir inside $HOME to the loader's search paths */
- gdict_source_loader_add_search_path (priv->loader,
- gtr_dirs_get_user_config_dir ());
-
- /* settings */
- priv->settings = g_settings_new ("org.gnome.gtranslator.plugins.dictionary");
-
- g_signal_connect (priv->settings,
- "changed",
- G_CALLBACK (on_settings_changed),
- panel);
-
- /* force retrieval of the configuration from gsettings */
- gtr_dict_panel_set_source_name (panel, NULL);
-
- /* Draw widgets */
- gtr_dict_panel_draw (panel);
}
static void
diff --git a/plugins/glossary/glossary-panel.c b/plugins/glossary/glossary-panel.c
index 79c6516..2532c81 100644
--- a/plugins/glossary/glossary-panel.c
+++ b/plugins/glossary/glossary-panel.c
@@ -132,16 +132,12 @@ gtr_glossary_panel_load_items (GtrGlossaryPanel * panel)
}
static void
-gtr_glossary_panel_draw (GtrGlossaryPanel * panel)
+gtr_glossary_panel_init (GtrGlossaryPanel * panel)
{
GtrGlossaryPanelPrivate *priv = panel->priv;
priv->tree = gtk_tree_view_new ();
-}
-static void
-gtr_glossary_panel_init (GtrGlossaryPanel * panel)
-{
panel->priv = GTR_GLOSSARY_PANEL_GET_PRIVATE (panel);
gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
diff --git a/plugins/open-tran/gtr-open-tran-panel.c b/plugins/open-tran/gtr-open-tran-panel.c
index 694d34b..59448f8 100644
--- a/plugins/open-tran/gtr-open-tran-panel.c
+++ b/plugins/open-tran/gtr-open-tran-panel.c
@@ -475,12 +475,19 @@ gtr_open_tran_panel_draw_treeview (GtrOpenTranPanel * panel)
}
static void
-gtr_open_tran_panel_draw (GtrOpenTranPanel * panel)
+gtr_open_tran_panel_init (GtrOpenTranPanel * panel)
{
GtkWidget *scrolledwindow;
GtkWidget *button;
GtkWidget *hbox;
+ panel->priv = GTR_OPEN_TRAN_PANEL_GET_PRIVATE (panel);
+
+ panel->priv->settings = g_settings_new ("org.gnome.gtranslator.plugins.open-tran");
+
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
+ GTK_ORIENTATION_VERTICAL);
+
/*
* Set up the scrolling window
*/
@@ -512,20 +519,7 @@ gtr_open_tran_panel_draw (GtrOpenTranPanel * panel)
G_CALLBACK (entry_activate_cb), panel);
gtk_box_pack_start (GTK_BOX (panel), hbox, FALSE, TRUE, 0);
-}
-
-static void
-gtr_open_tran_panel_init (GtrOpenTranPanel * panel)
-{
-
- panel->priv = GTR_OPEN_TRAN_PANEL_GET_PRIVATE (panel);
-
- panel->priv->settings = g_settings_new ("org.gnome.gtranslator.plugins.open-tran");
-
- gtk_orientable_set_orientation (GTK_ORIENTABLE (panel),
- GTK_ORIENTATION_VERTICAL);
- gtr_open_tran_panel_draw (panel);
}
static void
diff --git a/src/gtr-message-table.c b/src/gtr-message-table.c
index 954879f..e69e990 100644
--- a/src/gtr-message-table.c
+++ b/src/gtr-message-table.c
@@ -231,15 +231,22 @@ sort_message_list (GtkTreeViewColumn * column, GtrMessageTable * table)
g_list_first (messages), FALSE, GTR_TAB_MOVE_NONE);
}
+
static void
-gtr_message_table_draw (GtrMessageTable * table)
+gtr_message_table_init (GtrMessageTable * table)
{
- GtrMessageTablePrivate *priv = table->priv;
-
+ GtkWidget *scrolledwindow;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
+ table->priv = GTR_MESSAGE_TABLE_GET_PRIVATE (table);
+
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (table),
+ GTK_ORIENTATION_VERTICAL);
+
+ GtrMessageTablePrivate *priv = table->priv;
+
priv->store = gtr_message_table_model_new ();
priv->sort_model =
@@ -337,20 +344,6 @@ gtr_message_table_draw (GtrMessageTable * table)
g_signal_connect (G_OBJECT (selection), "changed",
G_CALLBACK (gtr_message_table_selection_changed), table);
-}
-
-
-static void
-gtr_message_table_init (GtrMessageTable * table)
-{
- GtkWidget *scrolledwindow;
-
- table->priv = GTR_MESSAGE_TABLE_GET_PRIVATE (table);
-
- gtk_orientable_set_orientation (GTK_ORIENTABLE (table),
- GTK_ORIENTATION_VERTICAL);
-
- gtr_message_table_draw (table);
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
gtk_box_pack_start (GTK_BOX (table), scrolledwindow, TRUE, TRUE, 0);
diff --git a/src/gtr-tab.c b/src/gtr-tab.c
index 9e0a36c..b567bc6 100644
--- a/src/gtr-tab.c
+++ b/src/gtr-tab.c
@@ -669,7 +669,25 @@ on_layout_changed (GdlDockMaster *master,
}
static void
-gtr_tab_draw (GtrTab *tab)
+extension_added (PeasExtensionSet *extensions,
+ PeasPluginInfo *info,
+ PeasExtension *exten,
+ GtrTab *tab)
+{
+ gtr_tab_activatable_activate (GTR_TAB_ACTIVATABLE (exten));
+}
+
+static void
+extension_removed (PeasExtensionSet *extensions,
+ PeasPluginInfo *info,
+ PeasExtension *exten,
+ GtrTab *tab)
+{
+ gtr_tab_activatable_deactivate (GTR_TAB_ACTIVATABLE (exten));
+}
+
+static void
+gtr_tab_init (GtrTab * tab)
{
GtkWidget *hbox;
GtkWidget *vertical_box;
@@ -678,6 +696,18 @@ gtr_tab_draw (GtrTab *tab)
GtkWidget *dockbar;
GtrTabPrivate *priv = tab->priv;
+ tab->priv = GTR_TAB_GET_PRIVATE (tab);
+
+ tab->priv->ui_settings = g_settings_new ("org.gnome.gtranslator.preferences.ui");
+ tab->priv->files_settings = g_settings_new ("org.gnome.gtranslator.preferences.files");
+ tab->priv->editor_settings = g_settings_new ("org.gnome.gtranslator.preferences.editor");
+ tab->priv->state_settings = g_settings_new ("org.gnome.gtranslator.state.window");
+
+ g_signal_connect (tab, "message-changed", G_CALLBACK (update_status), NULL);
+
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (tab),
+ GTK_ORIENTATION_VERTICAL);
+
/* Docker */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (hbox);
@@ -802,42 +832,6 @@ gtr_tab_draw (GtrTab *tab)
NULL,
GTR_TAB_PLACEMENT_RIGHT,
FALSE);
-}
-
-static void
-extension_added (PeasExtensionSet *extensions,
- PeasPluginInfo *info,
- PeasExtension *exten,
- GtrTab *tab)
-{
- gtr_tab_activatable_activate (GTR_TAB_ACTIVATABLE (exten));
-}
-
-static void
-extension_removed (PeasExtensionSet *extensions,
- PeasPluginInfo *info,
- PeasExtension *exten,
- GtrTab *tab)
-{
- gtr_tab_activatable_deactivate (GTR_TAB_ACTIVATABLE (exten));
-}
-
-static void
-gtr_tab_init (GtrTab * tab)
-{
- tab->priv = GTR_TAB_GET_PRIVATE (tab);
-
- tab->priv->ui_settings = g_settings_new ("org.gnome.gtranslator.preferences.ui");
- tab->priv->files_settings = g_settings_new ("org.gnome.gtranslator.preferences.files");
- tab->priv->editor_settings = g_settings_new ("org.gnome.gtranslator.preferences.editor");
- tab->priv->state_settings = g_settings_new ("org.gnome.gtranslator.state.window");
-
- g_signal_connect (tab, "message-changed", G_CALLBACK (update_status), NULL);
-
- gtk_orientable_set_orientation (GTK_ORIENTABLE (tab),
- GTK_ORIENTATION_VERTICAL);
-
- gtr_tab_draw (tab);
/* Manage auto save data */
tab->priv->autosave = g_settings_get_boolean (tab->priv->files_settings,
diff --git a/src/gtr-window.c b/src/gtr-window.c
index 7accd00..534973e 100644
--- a/src/gtr-window.c
+++ b/src/gtr-window.c
@@ -1369,13 +1369,56 @@ on_profile_modified (GtrProfileManager *manager,
}
static void
-gtr_window_draw (GtrWindow * window)
+extension_added (PeasExtensionSet *extensions,
+ PeasPluginInfo *info,
+ PeasExtension *exten,
+ GtrWindow *window)
+{
+ gtr_window_activatable_activate (GTR_WINDOW_ACTIVATABLE (exten));
+}
+
+static void
+extension_removed (PeasExtensionSet *extensions,
+ PeasPluginInfo *info,
+ PeasExtension *exten,
+ GtrWindow *window)
+{
+ gtr_window_activatable_deactivate (GTR_WINDOW_ACTIVATABLE (exten));
+
+ /* Ensure update of ui manager, because we suspect it does something
+ * with expected static strings in the type module (when unloaded the
+ * strings don't exist anymore, and ui manager updates in an idle
+ * func) */
+ gtk_ui_manager_ensure_update (window->priv->ui_manager);
+}
+
+static void
+gtr_window_init (GtrWindow * window)
{
+ GtkTargetList *tl;
GtkWidget *widget;
GError *error = NULL;
GtkActionGroup *action_group;
GtrWindowPrivate *priv = window->priv;
+ window->priv = GTR_WINDOW_GET_PRIVATE (window);
+
+ window->priv->state_settings = g_settings_new ("org.gnome.gtranslator.state.window");
+
+ window->priv->dispose_has_run = FALSE;
+
+ /* Profile manager */
+ window->priv->prof_manager = gtr_profile_manager_get_default ();
+
+ g_signal_connect (window->priv->prof_manager, "active-profile-changed",
+ G_CALLBACK (on_active_profile_changed), window);
+ g_signal_connect (window->priv->prof_manager, "profile-added",
+ G_CALLBACK (on_profile_added), window);
+ g_signal_connect (window->priv->prof_manager, "profile-removed",
+ G_CALLBACK (on_profile_removed), window);
+ g_signal_connect (window->priv->prof_manager, "profile-modified",
+ G_CALLBACK (on_profile_modified), window);
+
/* Main box */
priv->main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), priv->main_box);
@@ -1483,57 +1526,7 @@ gtr_window_draw (GtrWindow * window)
/* statusbar & progress bar */
create_statusbar (window);
-}
-
-static void
-extension_added (PeasExtensionSet *extensions,
- PeasPluginInfo *info,
- PeasExtension *exten,
- GtrWindow *window)
-{
- gtr_window_activatable_activate (GTR_WINDOW_ACTIVATABLE (exten));
-}
-
-static void
-extension_removed (PeasExtensionSet *extensions,
- PeasPluginInfo *info,
- PeasExtension *exten,
- GtrWindow *window)
-{
- gtr_window_activatable_deactivate (GTR_WINDOW_ACTIVATABLE (exten));
-
- /* Ensure update of ui manager, because we suspect it does something
- * with expected static strings in the type module (when unloaded the
- * strings don't exist anymore, and ui manager updates in an idle
- * func) */
- gtk_ui_manager_ensure_update (window->priv->ui_manager);
-}
-
-static void
-gtr_window_init (GtrWindow * window)
-{
- GtkTargetList *tl;
-
- window->priv = GTR_WINDOW_GET_PRIVATE (window);
-
- window->priv->state_settings = g_settings_new ("org.gnome.gtranslator.state.window");
-
- window->priv->dispose_has_run = FALSE;
-
- /* Profile manager */
- window->priv->prof_manager = gtr_profile_manager_get_default ();
-
- g_signal_connect (window->priv->prof_manager, "active-profile-changed",
- G_CALLBACK (on_active_profile_changed), window);
- g_signal_connect (window->priv->prof_manager, "profile-added",
- G_CALLBACK (on_profile_added), window);
- g_signal_connect (window->priv->prof_manager, "profile-removed",
- G_CALLBACK (on_profile_removed), window);
- g_signal_connect (window->priv->prof_manager, "profile-modified",
- G_CALLBACK (on_profile_modified), window);
- /* set up the window widgets */
- gtr_window_draw (window);
set_sensitive_according_to_window (window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]