Commit b4ec2629 authored by Daniel García Moreno's avatar Daniel García Moreno

Autofill profile fields based on language

I've added an advanced checkbox and by default only the language
selection is enabled. If you check the advanced all the inputs became
editable.

By default all fields are filled based on the language selection.

See #16
parent 3a9b240d
......@@ -46,6 +46,7 @@ typedef struct
GtkWidget *profile_name;
GtkWidget *name;
GtkWidget *email;
GtkWidget *team_email;
/* Profiles Page 2 */
GtkWidget *languages_fetcher;
......@@ -87,6 +88,9 @@ on_assistant_apply (GtkAssistant * assistant)
gtk_entry_get_text (GTK_ENTRY
(priv->email)));
gtr_profile_set_group_email (profile,
gtk_entry_get_text (GTK_ENTRY (priv->team_email)));
gtr_profile_set_language_name (profile,
gtr_languages_fetcher_get_language_name (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)));
......@@ -99,9 +103,6 @@ on_assistant_apply (GtkAssistant * assistant)
gtr_profile_set_encoding (profile,
gtr_languages_fetcher_get_encoding (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)));
gtr_profile_set_group_email (profile,
gtr_languages_fetcher_get_team_email (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)));
gtr_profile_set_plural_forms (profile,
gtr_languages_fetcher_get_plural_form (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)));
......@@ -138,7 +139,7 @@ on_assistant_prepare (GtkAssistant * assistant, GtkWidget * page)
gtk_entry_get_text (GTK_ENTRY (priv->name)),
gtk_entry_get_text (GTK_ENTRY (priv->email)),
gtr_languages_fetcher_get_language_name (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)),
gtr_languages_fetcher_get_team_email (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)),
gtk_entry_get_text (GTK_ENTRY (priv->team_email)),
gtr_languages_fetcher_get_language_code (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)),
gtr_languages_fetcher_get_charset (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)),
gtr_languages_fetcher_get_encoding (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)),
......@@ -212,6 +213,18 @@ on_profile1_entry_changed (GtkWidget * widget, GtrAssistant * as)
/* Translator email */
text = gtk_entry_get_text (GTK_ENTRY (priv->email));
if (text && *text)
gtk_assistant_set_page_complete (GTK_ASSISTANT (as), current_page, TRUE);
else
{
gtk_assistant_set_page_complete (GTK_ASSISTANT (as), current_page,
FALSE);
return;
}
/* Team email */
text = gtk_entry_get_text (GTK_ENTRY (priv->team_email));
if (text && *text)
gtk_assistant_set_page_complete (GTK_ASSISTANT (as), current_page, TRUE);
else
......@@ -242,10 +255,10 @@ create_profiles_page1 (GtrAssistant * as)
gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
label = gtk_label_new (NULL);
markup = g_strdup_printf("<b>%s</b>", _("Profile name:"));
markup = g_strdup_printf("<b>%s</b>", _("Profile name"));
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free(markup);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_xalign (GTK_LABEL (label), 1.0);
gtk_label_set_yalign (GTK_LABEL (label), 0.5);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
......@@ -264,10 +277,10 @@ create_profiles_page1 (GtrAssistant * as)
gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
label = gtk_label_new (NULL);
markup = g_strdup_printf("<b>%s</b>", ("Translator name:"));
markup = g_strdup_printf("<b>%s</b>", ("Translator name"));
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free(markup);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_xalign (GTK_LABEL (label), 1.0);
gtk_label_set_yalign (GTK_LABEL (label), 0.5);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
......@@ -286,10 +299,10 @@ create_profiles_page1 (GtrAssistant * as)
gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
label = gtk_label_new (NULL);
markup = g_strdup_printf("<b>%s</b>", _("Translator email:"));
markup = g_strdup_printf("<b>%s</b>", _("Translator email"));
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free(markup);
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
gtk_label_set_xalign (GTK_LABEL (label), 1.0);
gtk_label_set_yalign (GTK_LABEL (label), 0.5);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
......@@ -300,6 +313,28 @@ create_profiles_page1 (GtrAssistant * as)
g_signal_connect (G_OBJECT (priv->email), "changed",
G_CALLBACK (on_profile1_entry_changed), as);
/*
* Team email:
*/
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
label = gtk_label_new (NULL);
markup = g_strdup_printf("<b>%s</b>", _("Team email"));
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free(markup);
gtk_label_set_xalign (GTK_LABEL (label), 1.0);
gtk_label_set_yalign (GTK_LABEL (label), 0.5);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
priv->team_email = gtk_entry_new ();
gtk_widget_show (priv->team_email);
gtk_box_pack_start (GTK_BOX (hbox), priv->team_email, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (priv->team_email), "changed",
G_CALLBACK (on_profile1_entry_changed), as);
gtk_assistant_append_page (GTK_ASSISTANT (as), box);
gtk_assistant_set_page_title (GTK_ASSISTANT (as), box, _("Profile"));
}
......@@ -363,14 +398,6 @@ on_profile2_entry_changed (GtkWidget * widget, GtrAssistant * as)
return;
}
/* Team email */
text = gtr_languages_fetcher_get_team_email (GTR_LANGUAGES_FETCHER (priv->languages_fetcher));
if (text && *text)
gtk_assistant_set_page_complete (GTK_ASSISTANT (as), current_page, TRUE);
else
gtk_assistant_set_page_complete (GTK_ASSISTANT (as), current_page, FALSE);
/* Plural form */
text = gtr_languages_fetcher_get_plural_form (GTR_LANGUAGES_FETCHER (priv->languages_fetcher));
......
......@@ -32,6 +32,7 @@ typedef struct
GtkWidget *encoding;
GtkWidget *team_email;
GtkWidget *plural_forms;
GtkWidget *advanced;
GtkListStore *language_store;
GtkListStore *code_store;
......@@ -173,12 +174,12 @@ fill_encoding_and_charset (GtrLanguagesFetcher *fetcher)
text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->charset))));
if (text == NULL || *text == '\0')
if (text == NULL || *text == '\0' || !gtk_widget_is_sensitive (priv->charset))
gtk_combo_box_set_active (GTK_COMBO_BOX (priv->charset), 0);
text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->encoding))));
if (text == NULL || *text == '\0')
if (text == NULL || *text == '\0' || !gtk_widget_is_sensitive (priv->encoding))
gtk_combo_box_set_active (GTK_COMBO_BOX (priv->encoding), 0);
}
......@@ -186,34 +187,19 @@ static void
fill_from_language_entry (GtrLanguagesFetcher *fetcher,
GtrLanguage *lang)
{
const gchar *entry_text;
GtrLanguagesFetcherPrivate *priv = gtr_languages_fetcher_get_instance_private (fetcher);
fill_encoding_and_charset (fetcher);
entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->language_code))));
if (*entry_text == '\0')
{
const gchar *code;
code = gtr_language_get_code (lang);
if (code != NULL && *code != '\0')
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->language_code))), code);
}
entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->plural_forms))));
if (*entry_text == '\0')
{
const gchar *plural_form;
const gchar *code;
code = gtr_language_get_code (lang);
if (code != NULL && *code != '\0')
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->language_code))), code);
plural_form = gtr_language_get_plural_form (lang);
if (plural_form != NULL && *plural_form != '\0')
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->plural_forms))), plural_form);
}
const gchar *plural_form;
plural_form = gtr_language_get_plural_form (lang);
if (plural_form != NULL && *plural_form != '\0')
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->plural_forms))), plural_form);
}
static void
......@@ -342,6 +328,30 @@ on_combo_box_changed (GtkWidget *widget,
g_signal_emit (fetcher, signals[CHANGED], 0, NULL);
}
static void
on_advanced_changed (GtkToggleButton *widget,
GtrLanguagesFetcher *fetcher)
{
GtrLanguagesFetcherPrivate *priv = gtr_languages_fetcher_get_instance_private (fetcher);
gboolean active = gtk_toggle_button_get_active (widget);
gtk_widget_set_sensitive (priv->language_code, active);
gtk_widget_set_sensitive (priv->charset, active);
gtk_widget_set_sensitive (priv->encoding, active);
gtk_widget_set_sensitive (priv->plural_forms, active);
}
static void
on_lang_changed (GtkWidget *widget,
GtrLanguagesFetcher *fetcher)
{
GtrLanguagesFetcherPrivate *priv = gtr_languages_fetcher_get_instance_private (fetcher);
GtkWidget *entry = gtk_bin_get_child (GTK_BIN (priv->language));
on_language_activate (GTK_ENTRY (entry), fetcher);
g_signal_emit (fetcher, signals[CHANGED], 0, NULL);
}
static void
gtr_languages_fetcher_init (GtrLanguagesFetcher *fetcher)
{
......@@ -367,8 +377,8 @@ gtr_languages_fetcher_init (GtrLanguagesFetcher *fetcher)
priv->language_code = GTK_WIDGET (gtk_builder_get_object (builder, "language_code"));
priv->charset = GTK_WIDGET (gtk_builder_get_object (builder, "charset"));
priv->encoding = GTK_WIDGET (gtk_builder_get_object (builder, "encoding"));
priv->team_email = GTK_WIDGET (gtk_builder_get_object (builder, "team_email"));
priv->plural_forms = GTK_WIDGET (gtk_builder_get_object (builder, "plural_forms"));
priv->advanced = GTK_WIDGET (gtk_builder_get_object (builder, "advanced_check"));
priv->language_store = GTK_LIST_STORE (gtk_builder_get_object (builder, "language_store"));
priv->code_store = GTK_LIST_STORE (gtk_builder_get_object (builder, "code_store"));
g_object_unref (builder);
......@@ -397,7 +407,7 @@ gtr_languages_fetcher_init (GtrLanguagesFetcher *fetcher)
/* To emit the changed signal */
g_signal_connect (priv->language, "changed",
G_CALLBACK (on_combo_box_changed),
G_CALLBACK (on_lang_changed),
fetcher);
g_signal_connect (priv->language_code, "changed",
G_CALLBACK (on_combo_box_changed),
......@@ -408,12 +418,13 @@ gtr_languages_fetcher_init (GtrLanguagesFetcher *fetcher)
g_signal_connect (priv->encoding, "changed",
G_CALLBACK (on_combo_box_changed),
fetcher);
g_signal_connect (priv->team_email, "changed",
G_CALLBACK (on_combo_box_changed),
fetcher);
g_signal_connect (priv->plural_forms, "changed",
G_CALLBACK (on_combo_box_changed),
fetcher);
g_signal_connect (priv->advanced, "toggled",
G_CALLBACK (on_advanced_changed),
fetcher);
}
GtkWidget *
......@@ -502,26 +513,6 @@ gtr_languages_fetcher_set_encoding (GtrLanguagesFetcher *fetcher,
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->encoding))), enc);
}
const gchar *
gtr_languages_fetcher_get_team_email (GtrLanguagesFetcher *fetcher)
{
GtrLanguagesFetcherPrivate *priv = gtr_languages_fetcher_get_instance_private (fetcher);
g_return_val_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher), NULL);
return gtk_entry_get_text (GTK_ENTRY (priv->team_email));
}
void
gtr_languages_fetcher_set_team_email (GtrLanguagesFetcher *fetcher,
const gchar *email)
{
GtrLanguagesFetcherPrivate *priv = gtr_languages_fetcher_get_instance_private (fetcher);
g_return_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher));
g_return_if_fail (email != NULL);
gtk_entry_set_text (GTK_ENTRY (priv->team_email), email);
}
const gchar *
gtr_languages_fetcher_get_plural_form (GtrLanguagesFetcher *fetcher)
{
......
......@@ -41,6 +41,7 @@ struct _GtrLanguagesFetcherClass
GtkBoxClass parent_class;
void (* changed) (GtrLanguagesFetcher *fetcher);
void (* lang_changed) (GtrLanguagesFetcher *fetcher);
};
GType gtr_languages_fetcher_get_type (void) G_GNUC_CONST;
......@@ -67,11 +68,6 @@ const gchar *gtr_languages_fetcher_get_encoding (GtrLanguagesF
void gtr_languages_fetcher_set_encoding (GtrLanguagesFetcher *fetcher,
const gchar *enc);
const gchar *gtr_languages_fetcher_get_team_email (GtrLanguagesFetcher *fetcher);
void gtr_languages_fetcher_set_team_email (GtrLanguagesFetcher *fetcher,
const gchar *email);
const gchar *gtr_languages_fetcher_get_plural_form (GtrLanguagesFetcher *fetcher);
void gtr_languages_fetcher_set_plural_form (GtrLanguagesFetcher *fetcher,
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<requires lib="gtk+" version="3.0"/>
<object class="GtkListStore" id="code_store">
<columns>
<!-- column-name text -->
......@@ -19,50 +20,50 @@
</object>
<object class="GtkWindow" id="languages-fetcher">
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="main_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkTable" id="table4">
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="row_spacing">4</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label15">
<object class="GtkLabel" id="label11">
<property name="width_request">80</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Team email:</property>
<property name="label" translatable="yes">_Language</property>
<property name="use_underline">True</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label14">
<object class="GtkLabel" id="label12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Transfer en_coding:</property>
<property name="label" translatable="yes">Language _code</property>
<property name="use_underline">True</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
......@@ -70,180 +71,159 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Character _set</property>
<property name="use_underline">True</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label12">
<object class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Language _code:</property>
<property name="label" translatable="yes">Transfer en_coding</property>
<property name="use_underline">True</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label11">
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Language:</property>
<property name="label" translatable="yes">_Plural forms</property>
<property name="use_underline">True</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="team_email">
<object class="GtkComboBox" id="language_code">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="invisible_char"></property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="model">code_store</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="charset">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<items>
<item>UTF-8</item>
</items>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxentry-entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="encoding">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<items>
<item>8bit</item>
</items>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxentry-entry1">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="language">
<object class="GtkComboBoxText" id="plural_forms">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="model">language_store</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxentry-entry2">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="language_code">
<object class="GtkComboBox" id="language">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">code_store</property>
<property name="hexpand">True</property>
<property name="model">language_store</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxentry-entry3">
<object class="GtkEntry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Plural forms:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="plural_forms">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_entry">True</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxentry-entry4">
<child>
<object class="GtkCheckButton" id="advanced_check">
<property name="label" translatable="yes">Advanced</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</object>
......
......@@ -43,6 +43,7 @@ typedef struct
GtkWidget *author_name;
GtkWidget *author_email;
GtkWidget *team_email;
GtkWidget *languages_fetcher;
} GtrProfileDialogPrivate;
......@@ -93,6 +94,7 @@ gtr_profile_dialog_init (GtrProfileDialog *dlg)
priv->profile_name = GTK_WIDGET (gtk_builder_get_object (builder, "profile_name"));
priv->author_name = GTK_WIDGET (gtk_builder_get_object (builder, "name"));
priv->author_email = GTK_WIDGET (gtk_builder_get_object (builder, "email"));
priv->team_email = GTK_WIDGET (gtk_builder_get_object (builder, "team_email"));
fetcher_box = GTK_WIDGET (gtk_builder_get_object (builder, "fetcher_box"));
g_object_unref (builder);
......@@ -120,6 +122,10 @@ fill_entries (GtrProfileDialog *dlg, GtrProfile *profile)
gtk_entry_set_text (GTK_ENTRY (priv->author_email),
gtr_profile_get_author_email (profile));
if (gtr_profile_get_group_email (profile) != NULL)
gtk_entry_set_text (GTK_ENTRY (priv->team_email),
gtr_profile_get_group_email (profile));
if (gtr_profile_get_language_name (profile) != NULL)
gtr_languages_fetcher_set_language_name (GTR_LANGUAGES_FETCHER (priv->languages_fetcher),
gtr_profile_get_language_name (profile));
......@@ -136,10 +142,6 @@ fill_entries (GtrProfileDialog *dlg, GtrProfile *profile)
gtr_languages_fetcher_set_encoding (GTR_LANGUAGES_FETCHER (priv->languages_fetcher),
gtr_profile_get_encoding (profile));
if (gtr_profile_get_group_email (profile) != NULL)
gtr_languages_fetcher_set_team_email (GTR_LANGUAGES_FETCHER (priv->languages_fetcher),
gtr_profile_get_group_email (profile));
if (gtr_profile_get_plural_forms (profile) != NULL)
gtr_languages_fetcher_set_plural_form (GTR_LANGUAGES_FETCHER (priv->languages_fetcher),
gtr_profile_get_plural_forms (profile));
......@@ -195,6 +197,9 @@ gtr_profile_dialog_get_profile (GtrProfileDialog *dlg)
gtr_profile_set_author_email (profile,
gtk_entry_get_text (GTK_ENTRY (priv->author_email)));
gtr_profile_set_group_email (profile,
gtk_entry_get_text (GTK_ENTRY (priv->team_email)));
gtr_profile_set_language_name (profile,
gtr_languages_fetcher_get_language_name (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)));
......@@ -207,11 +212,8 @@ gtr_profile_dialog_get_profile (GtrProfileDialog *dlg)
gtr_profile_set_encoding (profile,
gtr_languages_fetcher_get_encoding (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)));
gtr_profile_set_group_email (profile,
gtr_languages_fetcher_get_team_email (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)));
gtr_profile_set_plural_forms (profile,
gtr_languages_fetcher_get_plural_form (GTR_LANGUAGES_FETCHER (priv->languages_fetcher)));
return profile;
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -286,4 +286,4 @@ gtr_profile_set_plural_forms (GtrProfile *profile,
g_free (priv->plural_forms);
priv->plural_forms = g_strdup (data);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment