[gnome-color-manager] Move the profile viewer button in the control center to some hyperlink text



commit 83578360ef3d3f6cd3b59d6f6e570db2b8bf89ce
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 9 18:37:26 2011 +0000

    Move the profile viewer button in the control center to some hyperlink text

 data/gcm-prefs.ui    |   29 ++++++++++-------------
 src/cc-color-panel.c |   62 +++++++++++++++++++++++++++----------------------
 2 files changed, 47 insertions(+), 44 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index 1346a85..92b4098 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -201,21 +201,6 @@
                 <property name="position">2</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkButton" id="button_viewer">
-                <property name="label" translatable="yes" comments="Button to view installed profiles">Pr_ofile Viewer</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
           </object>
         </child>
         <child>
@@ -633,6 +618,19 @@
                     <property name="position">1</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkLabel" id="label_viewer">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label">&lt;a href="moo"&gt;Compare profiles...&lt;/a&gt;</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="position">3</property>
@@ -814,7 +812,6 @@
     <action-widgets>
       <action-widget response="0">button_help</action-widget>
       <action-widget response="0">button_default</action-widget>
-      <action-widget response="0">button_viewer</action-widget>
     </action-widgets>
   </object>
   <object class="GtkDialog" id="dialog_virtual">
diff --git a/src/cc-color-panel.c b/src/cc-color-panel.c
index f174816..8f53d44 100644
--- a/src/cc-color-panel.c
+++ b/src/cc-color-panel.c
@@ -216,31 +216,6 @@ cc_color_panel_help_cb (GtkWidget *widget, CcColorPanel *panel)
 }
 
 /**
- * cc_color_panel_viewer_cb:
- **/
-static void
-cc_color_panel_viewer_cb (GtkWidget *widget, CcColorPanel *panel)
-{
-	gboolean ret;
-	GError *error = NULL;
-	guint xid;
-	gchar *command;
-
-	/* get xid */
-	xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (panel->priv->main_window)));
-
-	/* run with modal set */
-	command = g_strdup_printf ("%s/gcm-viewer --parent-window %u", BINDIR, xid);
-	g_debug ("running: %s", command);
-	ret = g_spawn_command_line_async (command, &error);
-	if (!ret) {
-		g_warning ("failed to run prefs: %s", error->message);
-		g_error_free (error);
-	}
-	g_free (command);
-}
-
-/**
  * cc_color_panel_calibrate_display:
  **/
 static gboolean
@@ -2356,6 +2331,31 @@ cc_color_panel_class_finalize (CcColorPanelClass *klass)
 {
 }
 
+static gboolean
+cc_color_panel_activate_link_cb (GtkLabel *label,
+				 const gchar *uri,
+				 CcColorPanel *panel)
+{
+	gboolean ret;
+	GError *error = NULL;
+	guint xid;
+	gchar *command;
+
+	/* get xid */
+	xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (panel->priv->main_window)));
+
+	/* run with modal set */
+	command = g_strdup_printf ("%s/gcm-viewer --parent-window %u", BINDIR, xid);
+	g_debug ("running: %s", command);
+	ret = g_spawn_command_line_async (command, &error);
+	if (!ret) {
+		g_warning ("failed to run prefs: %s", error->message);
+		g_error_free (error);
+	}
+	g_free (command);
+	return TRUE;
+}
+
 static void
 cc_color_panel_finalize (GObject *object)
 {
@@ -2391,6 +2391,7 @@ cc_color_panel_init (CcColorPanel *panel)
 	GtkWidget *info_bar_profiles_label;
 	GtkWidget *main_window;
 	GtkWidget *widget;
+	gchar *text = NULL;
 
 	panel->priv = CC_COLOR_PREFS_GET_PRIVATE (panel);
 	panel->priv->cancellable = g_cancellable_new ();
@@ -2485,9 +2486,13 @@ cc_color_panel_init (CcColorPanel *panel)
 	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (cc_color_panel_help_cb), panel);
 	widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
-						     "button_viewer"));
-	g_signal_connect (widget, "clicked",
-			  G_CALLBACK (cc_color_panel_viewer_cb), panel);
+						     "label_viewer"));
+	g_signal_connect (widget, "activate-link",
+			  G_CALLBACK (cc_color_panel_activate_link_cb), panel);
+	/* TRANSLATORS: link to gcm-viewer */
+	text = g_strdup_printf ("<a href=\"moo\">%s</a>",
+				_("Compare profiles..."));
+	gtk_label_set_markup (GTK_LABEL (widget), text);
 	widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
 						     "button_delete"));
 	g_signal_connect (widget, "clicked",
@@ -2639,6 +2644,7 @@ if(0)	cc_color_panel_setup_drag_and_drop (GTK_WIDGET (panel->priv->main_window))
 	/* do all this after the window has been set up */
 	g_idle_add ((GSourceFunc) cc_color_panel_startup_idle_cb, panel);
 out:
+	g_free (text);
 	return;
 }
 



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