[gnome-calendar/calendar-editor] source-dialog: open GNOME Control Center when the description label's link is activated



commit 6bbabdd732291165e498f6a04faf9539a6978e83
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Feb 9 15:35:18 2015 -0200

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

 data/ui/source-dialog.ui |    4 +++-
 src/gcal-source-dialog.c |   25 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/source-dialog.ui b/data/ui/source-dialog.ui
index ec07f12..bea1bed 100644
--- a/data/ui/source-dialog.ui
+++ b/data/ui/source-dialog.ui
@@ -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>
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 2aa5c5b..f9b2cbe 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -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);
@@ -88,6 +92,26 @@ action_widget_activated (GtkWidget *widget,
 }
 
 /**
+ * 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:
  *
  * Callend when the name entry's text
@@ -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);
 }
 


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