source-dialog: open GNOME Control Center when the description label's link is activated

This commit is contained in:
Georges Basile Stavracas Neto
2015-05-25 12:31:06 -04:00
committed by Erick Pérez Castellanos
parent 9a3e0e51ba
commit 84112ae721
2 changed files with 28 additions and 1 deletions
+3 -1
View File
@@ -138,9 +138,11 @@
<object class="GtkLabel" id="web_description_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Enter the address of the calendar that you want to add. If the calendar belongs to one of you online accounts, you can add it through the online account settings.</property>
<property name="label" translatable="yes">Enter the address of the calendar that you want to add. If the calendar belongs to one of you online accounts, you can add it through the &lt;a href="GOA"&gt;online account settings&lt;/a&gt;.</property>
<property name="use_markup">True</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
<signal name="activate_link" handler="description_label_link_activated" object="GcalSourceDialog" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
+25
View File
@@ -52,6 +52,10 @@ struct _GcalSourceDialog
static void action_widget_activated (GtkWidget *widget,
gpointer user_data);
static gboolean description_label_link_activated (GtkWidget *widget,
gchar *uri,
gpointer user_data);
static void name_entry_text_changed (GObject *object,
GParamSpec *pspec,
gpointer user_data);
@@ -87,6 +91,26 @@ action_widget_activated (GtkWidget *widget,
gtk_dialog_response (GTK_DIALOG (user_data), response);
}
/**
* description_label_link_activated:
*
* Show GNOME Control Center when
* the label's link is pressed.
*
* Returns:
*/
static gboolean
description_label_link_activated (GtkWidget *widget,
gchar *uri,
gpointer user_data)
{
gchar *command[] = {"gnome-control-center", "online-accounts", NULL};
g_spawn_async (NULL, command, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
return TRUE;
}
/**
* name_entry_text_changed:
*
@@ -196,6 +220,7 @@ gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, stack);
gtk_widget_class_bind_template_callback (widget_class, action_widget_activated);
gtk_widget_class_bind_template_callback (widget_class, description_label_link_activated);
gtk_widget_class_bind_template_callback (widget_class, name_entry_text_changed);
}