source-dialog: update source names

This commit is contained in:
Georges Basile Stavracas Neto
2015-05-25 12:35:30 -04:00
committed by Erick Pérez Castellanos
parent 3ca09ccfe4
commit 397e501413
2 changed files with 37 additions and 0 deletions
+2
View File
@@ -255,6 +255,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<signal name="notify::text" handler="new_name_entry_text_changed" object="GcalSourceDialog" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
@@ -409,6 +410,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<signal name="notify::text" handler="new_name_entry_text_changed" object="GcalSourceDialog" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
+35
View File
@@ -97,6 +97,10 @@ static void name_entry_text_changed (GObject *ob
GParamSpec *pspec,
gpointer user_data);
static void new_name_entry_text_changed (GObject *object,
GParamSpec *pspec,
gpointer user_data);
static void notebook_page_switched (GtkWidget *notebook,
GtkWidget *page,
guint page_num,
@@ -262,6 +266,36 @@ name_entry_text_changed (GObject *object,
e_source_set_display_name (priv->source, gtk_entry_get_text (GTK_ENTRY (priv->name_entry)));
}
/**
* new_name_entry_text_changed:
*
* Callend when the name entry of a
* new to-be-added source is edited.
* It changes the source's display
* name, but wait's for the calendar's
* 'response' signal to commit these
* changes.
*
* Returns:
*/
static void
new_name_entry_text_changed (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
GcalSourceDialogPrivate *priv = GCAL_SOURCE_DIALOG (user_data)->priv;
ESource *source = NULL;
if (GTK_WIDGET (object) == priv->web_new_calendar_name_entry)
source = priv->remote_source;
if (GTK_WIDGET (object) == priv->new_calendar_name_entry)
source = priv->local_source;
if (source != NULL)
e_source_set_display_name (source, gtk_entry_get_text (GTK_ENTRY (object)));
}
/**
* notebook_page_switched:
*
@@ -949,6 +983,7 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
gtk_widget_class_bind_template_callback (widget_class, default_check_toggled);
gtk_widget_class_bind_template_callback (widget_class, description_label_link_activated);
gtk_widget_class_bind_template_callback (widget_class, name_entry_text_changed);
gtk_widget_class_bind_template_callback (widget_class, new_name_entry_text_changed);
gtk_widget_class_bind_template_callback (widget_class, notebook_page_switched);
gtk_widget_class_bind_template_callback (widget_class, response_signal);
gtk_widget_class_bind_template_callback (widget_class, url_entry_text_changed);