[gnome-control-center] Add link buttons to get more themes/backgrounds online



commit 68993660c69d74ce990009218ff6eabc0e1bf73b
Author: William Jon McCann <jmccann redhat com>
Date:   Sat Aug 22 10:13:16 2009 -0400

    Add link buttons to get more themes/backgrounds online
    
    Fixes #http://bugzilla.gnome.org/show_bug.cgi?id=323323

 capplets/appearance/appearance-desktop.c |   13 +++-
 capplets/appearance/appearance-themes.c  |   11 +++
 capplets/appearance/appearance.h         |    4 +
 capplets/appearance/data/Makefile.am     |    3 +-
 capplets/appearance/data/appearance.ui   |  132 +++++++++++++++++++++--------
 gnome-control-center.schemas.in          |   28 ++++++
 6 files changed, 152 insertions(+), 39 deletions(-)
---
diff --git a/capplets/appearance/appearance-desktop.c b/capplets/appearance/appearance-desktop.c
index bf2f5a1..09ba7aa 100644
--- a/capplets/appearance/appearance-desktop.c
+++ b/capplets/appearance/appearance-desktop.c
@@ -995,8 +995,9 @@ void
 desktop_init (AppearanceData *data,
 	      const gchar **uris)
 {
-  GtkWidget *add_button;
+  GtkWidget *add_button, *w;
   GtkCellRenderer *cr;
+  char *url;
 
   g_object_set (gtk_settings_get_default (), "gtk-tooltip-timeout", 500, NULL);
 
@@ -1010,6 +1011,16 @@ desktop_init (AppearanceData *data,
     }
   }
 
+  w = appearance_capplet_get_widget (data, "more_backgrounds_linkbutton");
+  url = gconf_client_get_string (data->client, MORE_BACKGROUNDS_URL_KEY, NULL);
+  if (url != NULL && url[0] != '\0') {
+    gtk_link_button_set_uri (GTK_LINK_BUTTON (w), url);
+    gtk_widget_show (w);
+  } else {
+    gtk_widget_hide (w);
+  }
+  g_free (url);
+
   data->wp_hash = g_hash_table_new (g_str_hash, g_str_equal);
 
   gconf_client_add_dir (data->client, WP_PATH_KEY,
diff --git a/capplets/appearance/appearance-themes.c b/capplets/appearance/appearance-themes.c
index 5318005..522106b 100644
--- a/capplets/appearance/appearance-themes.c
+++ b/capplets/appearance/appearance-themes.c
@@ -1016,6 +1016,7 @@ themes_init (AppearanceData *data)
   GtkIconView *icon_view;
   GtkCellRenderer *renderer;
   GtkSettings *settings;
+  char *url;
 
   /* initialise some stuff */
   gnome_theme_init ();
@@ -1127,6 +1128,16 @@ themes_init (AppearanceData *data)
   if (is_locked_down (data->client))
     gtk_widget_set_sensitive (w, FALSE);
 
+  w = appearance_capplet_get_widget (data, "more_themes_linkbutton");
+  url = gconf_client_get_string (data->client, MORE_THEMES_URL_KEY, NULL);
+  if (url != NULL && url[0] != '\0') {
+    gtk_link_button_set_uri (GTK_LINK_BUTTON (w), url);
+    gtk_widget_show (w);
+  } else {
+    gtk_widget_hide (w);
+  }
+  g_free (url);
+
   /* listen to gconf changes, too */
   gconf_client_add_dir (data->client, "/apps/metacity/general", GCONF_CLIENT_PRELOAD_NONE, NULL);
   gconf_client_add_dir (data->client, "/desktop/gnome/interface", GCONF_CLIENT_PRELOAD_NONE, NULL);
diff --git a/capplets/appearance/appearance.h b/capplets/appearance/appearance.h
index 7c30687..b28e4d1 100644
--- a/capplets/appearance/appearance.h
+++ b/capplets/appearance/appearance.h
@@ -27,6 +27,10 @@
 
 #include "gnome-theme-info.h"
 
+#define APPEARANCE_KEY_DIR "/apps/control-center/appearance"
+#define MORE_THEMES_URL_KEY APPEARANCE_KEY_DIR "/more_themes_url"
+#define MORE_BACKGROUNDS_URL_KEY APPEARANCE_KEY_DIR "/more_backgrounds_url"
+
 typedef struct
 {
   GConfClient *client;
diff --git a/capplets/appearance/data/Makefile.am b/capplets/appearance/data/Makefile.am
index 3571ffa..4e03a7d 100644
--- a/capplets/appearance/data/Makefile.am
+++ b/capplets/appearance/data/Makefile.am
@@ -36,7 +36,8 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 
 @INTLTOOL_XML_RULE@
 
-xml_in_files = gnome-theme-package.xml.in
+xml_in_files = \
+	gnome-theme-package.xml.in
 
 mimedir = $(datadir)/mime/packages
 mime_DATA = $(xml_in_files:.xml.in=.xml)
diff --git a/capplets/appearance/data/appearance.ui b/capplets/appearance/data/appearance.ui
index f6dbaa0..c7b4f92 100644
--- a/capplets/appearance/data/appearance.ui
+++ b/capplets/appearance/data/appearance.ui
@@ -10,14 +10,14 @@
     <property name="has_separator">False</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox1">
-        <property name="orientation">vertical</property>
         <property name="visible">True</property>
+        <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child>
           <object class="GtkVBox" id="vbox7">
-            <property name="orientation">vertical</property>
             <property name="visible">True</property>
             <property name="border_width">5</property>
+            <property name="orientation">vertical</property>
             <property name="spacing">18</property>
             <child>
               <object class="GtkAlignment" id="alignment5">
@@ -85,8 +85,8 @@
             </child>
             <child>
               <object class="GtkVBox" id="vbox8">
-                <property name="orientation">vertical</property>
                 <property name="visible">True</property>
+                <property name="orientation">vertical</property>
                 <child>
                   <object class="GtkLabel" id="label8">
                     <property name="visible">True</property>
@@ -116,8 +116,8 @@
                         <property name="row_spacing">6</property>
                         <child>
                           <object class="GtkVBox" id="vbox12">
-                            <property name="orientation">vertical</property>
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">3</property>
                             <child>
                               <object class="GtkRadioButton" id="antialias_none_radio">
@@ -154,8 +154,8 @@
                         </child>
                         <child>
                           <object class="GtkVBox" id="vbox13">
-                            <property name="orientation">vertical</property>
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">3</property>
                             <child>
                               <object class="GtkRadioButton" id="antialias_grayscale_radio">
@@ -195,8 +195,8 @@
                         </child>
                         <child>
                           <object class="GtkVBox" id="vbox14">
-                            <property name="orientation">vertical</property>
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">3</property>
                             <child>
                               <object class="GtkRadioButton" id="antialias_subpixel_radio">
@@ -251,8 +251,8 @@
             </child>
             <child>
               <object class="GtkVBox" id="vbox9">
-                <property name="orientation">vertical</property>
                 <property name="visible">True</property>
+                <property name="orientation">vertical</property>
                 <child>
                   <object class="GtkLabel" id="label9">
                     <property name="visible">True</property>
@@ -282,8 +282,8 @@
                         <property name="row_spacing">6</property>
                         <child>
                           <object class="GtkVBox" id="vbox15">
-                            <property name="orientation">vertical</property>
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">3</property>
                             <child>
                               <object class="GtkRadioButton" id="hint_none_radio">
@@ -317,8 +317,8 @@
                         </child>
                         <child>
                           <object class="GtkVBox" id="vbox16">
-                            <property name="orientation">vertical</property>
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">3</property>
                             <child>
                               <object class="GtkRadioButton" id="hint_slight_radio">
@@ -358,8 +358,8 @@
                         </child>
                         <child>
                           <object class="GtkVBox" id="vbox17">
-                            <property name="orientation">vertical</property>
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">3</property>
                             <child>
                               <object class="GtkRadioButton" id="hint_medium_radio">
@@ -399,8 +399,8 @@
                         </child>
                         <child>
                           <object class="GtkVBox" id="vbox18">
-                            <property name="orientation">vertical</property>
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">3</property>
                             <child>
                               <object class="GtkRadioButton" id="hint_full_radio">
@@ -455,8 +455,8 @@
             </child>
             <child>
               <object class="GtkVBox" id="vbox10">
-                <property name="orientation">vertical</property>
                 <property name="visible">True</property>
+                <property name="orientation">vertical</property>
                 <child>
                   <object class="GtkLabel" id="label10">
                     <property name="visible">True</property>
@@ -678,9 +678,9 @@
     <property name="has_separator">False</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
-        <property name="orientation">vertical</property>
         <property name="visible">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="orientation">vertical</property>
         <property name="spacing">2</property>
         <child>
           <object class="GtkNotebook" id="main_notebook">
@@ -690,16 +690,16 @@
             <property name="border_width">5</property>
             <child>
               <object class="GtkVBox" id="theme_vbox">
-                <property name="orientation">vertical</property>
                 <property name="visible">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="border_width">12</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <object class="GtkVBox" id="theme_list_vbox">
-                    <property name="orientation">vertical</property>
                     <property name="visible">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="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
                       <object class="GtkScrolledWindow" id="scrolledwindow1">
@@ -807,6 +807,35 @@
                     <property name="position">1</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkHBox" id="hbox1">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkLinkButton" id="more_themes_linkbutton">
+                        <property name="no_show_all">True</property>
+                        <property name="label" translatable="yes">Get more themes online</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="has_tooltip">True</property>
+                        <property name="relief">none</property>
+                        <property name="uri">http://art.gnome.org/themes</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
               </object>
             </child>
             <child type="tab">
@@ -821,9 +850,9 @@
             </child>
             <child>
               <object class="GtkVBox" id="background_vbox">
-                <property name="orientation">vertical</property>
                 <property name="visible">True</property>
                 <property name="border_width">12</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <object class="GtkLabel" id="label19">
@@ -868,8 +897,8 @@
                     </child>
                     <child>
                       <object class="GtkVBox" id="vbox4">
-                        <property name="orientation">vertical</property>
                         <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
                           <object class="GtkHBox" id="wp_hbox">
@@ -1093,6 +1122,35 @@
                     <property name="position">4</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkHBox" id="hbox2">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkLinkButton" id="more_backgrounds_linkbutton">
+                        <property name="no_show_all">True</property>
+
+                        <property name="label" translatable="yes">Get more backgrounds online</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="relief">none</property>
+                        <property name="uri">http://art.gnome.org/backgrounds</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">5</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="position">1</property>
@@ -1111,9 +1169,9 @@
             </child>
             <child>
               <object class="GtkVBox" id="fonts_vbox">
-                <property name="orientation">vertical</property>
                 <property name="visible">True</property>
                 <property name="border_width">12</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">18</property>
                 <child>
                   <object class="GtkTable" id="table2">
@@ -1284,8 +1342,8 @@
                 </child>
                 <child>
                   <object class="GtkVBox" id="vbox6">
-                    <property name="orientation">vertical</property>
                     <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
                       <object class="GtkLabel" id="label33">
@@ -1315,8 +1373,8 @@
                             <property name="row_spacing">6</property>
                             <child>
                               <object class="GtkVBox" id="vbox21">
-                                <property name="orientation">vertical</property>
                                 <property name="visible">True</property>
+                                <property name="orientation">vertical</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkRadioButton" id="subpixel_radio">
@@ -1358,8 +1416,8 @@
                             </child>
                             <child>
                               <object class="GtkVBox" id="vbox20">
-                                <property name="orientation">vertical</property>
                                 <property name="visible">True</property>
+                                <property name="orientation">vertical</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkRadioButton" id="best_contrast_radio">
@@ -1399,8 +1457,8 @@
                             </child>
                             <child>
                               <object class="GtkVBox" id="vbox19">
-                                <property name="orientation">vertical</property>
                                 <property name="visible">True</property>
+                                <property name="orientation">vertical</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkRadioButton" id="best_shapes_radio">
@@ -1440,8 +1498,8 @@
                             </child>
                             <child>
                               <object class="GtkVBox" id="vbox11">
-                                <property name="orientation">vertical</property>
                                 <property name="visible">True</property>
+                                <property name="orientation">vertical</property>
                                 <property name="spacing">6</property>
                                 <child>
                                   <object class="GtkRadioButton" id="monochrome_radio">
@@ -1532,14 +1590,14 @@
             </child>
             <child>
               <object class="GtkVBox" id="interface_vbox">
-                <property name="orientation">vertical</property>
                 <property name="visible">True</property>
                 <property name="border_width">12</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">18</property>
                 <child>
                   <object class="GtkVBox" id="vbox23">
-                    <property name="orientation">vertical</property>
                     <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
                       <object class="GtkLabel" id="label35">
@@ -1572,8 +1630,8 @@
                         </child>
                         <child>
                           <object class="GtkVBox" id="vbox24">
-                            <property name="orientation">vertical</property>
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
                               <object class="GtkCheckButton" id="menu_icons_toggle">
@@ -1670,8 +1728,8 @@
                 </child>
                 <child>
                   <object class="GtkVBox" id="vbox25">
-                    <property name="orientation">vertical</property>
                     <property name="visible">True</property>
+                    <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
                       <object class="GtkLabel" id="label38">
@@ -1704,8 +1762,8 @@
                         </child>
                         <child>
                           <object class="GtkVBox" id="vbox26">
-                            <property name="orientation">vertical</property>
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <child>
                               <object class="GtkMenuBar" id="menubar">
                                 <property name="visible">True</property>
@@ -2018,9 +2076,9 @@
     <property name="has_separator">False</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox4">
-        <property name="orientation">vertical</property>
         <property name="visible">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="orientation">vertical</property>
         <property name="spacing">2</property>
         <child>
           <object class="GtkNotebook" id="notebook2">
@@ -2030,16 +2088,16 @@
             <property name="border_width">5</property>
             <child>
               <object class="GtkVBox" id="vbox27">
-                <property name="orientation">vertical</property>
                 <property name="visible">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="border_width">12</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <object class="GtkVBox" id="gtk_themes_vbox">
-                    <property name="orientation">vertical</property>
                     <property name="visible">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="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
                       <object class="GtkScrolledWindow" id="scrolledwindow3">
@@ -2110,10 +2168,10 @@
             </child>
             <child>
               <object class="GtkVBox" id="vbox2">
-                <property name="orientation">vertical</property>
                 <property name="visible">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="border_width">12</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">18</property>
                 <child>
                   <object class="GtkHBox" id="color_scheme_message_hbox">
@@ -2377,10 +2435,10 @@
                       <object class="GtkButton" id="color_scheme_defaults_button">
                         <property name="label" translatable="yes">_Reset to Defaults</property>
                         <property name="visible">True</property>
-                        <property name="use_underline">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">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="use_underline">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -2412,10 +2470,10 @@
             </child>
             <child>
               <object class="GtkVBox" id="vbox29">
-                <property name="orientation">vertical</property>
                 <property name="visible">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="border_width">12</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <object class="GtkScrolledWindow" id="scrolledwindow5">
@@ -2484,10 +2542,10 @@
             </child>
             <child>
               <object class="GtkVBox" id="vbox30">
-                <property name="orientation">vertical</property>
                 <property name="visible">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="border_width">12</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <object class="GtkScrolledWindow" id="scrolledwindow6">
@@ -2556,10 +2614,10 @@
             </child>
             <child>
               <object class="GtkVBox" id="cursor_vbox">
-                <property name="orientation">vertical</property>
                 <property name="visible">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="border_width">12</property>
+                <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
                   <object class="GtkHBox" id="cursor_message_hbox">
@@ -2791,8 +2849,8 @@
     <property name="has_separator">False</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox3">
-        <property name="orientation">vertical</property>
         <property name="visible">True</property>
+        <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child>
           <object class="GtkTable" id="table3">
diff --git a/gnome-control-center.schemas.in b/gnome-control-center.schemas.in
index 11b04d4..9c9bba3 100644
--- a/gnome-control-center.schemas.in
+++ b/gnome-control-center.schemas.in
@@ -2,6 +2,34 @@
   <schemalist>
 
     <schema>
+      <key>/schemas/apps/control-center/appearance/more_backgrounds_url</key>
+      <applyto>/apps/control-center/appearance/more_backgrounds_url</applyto>
+      <owner>control-center</owner>
+      <type>string</type>
+      <default>http://art.gnome.org/backgrounds/</default>
+      <locale name="C">
+        <short>More backgrounds URL</short>
+        <long>
+          URL for where to get more desktop backgrounds.  If set to an
+          empty string the link will not appear.
+        </long>
+      </locale>
+    </schema>
+    <schema>
+      <key>/schemas/apps/control-center/appearance/more_themes_url</key>
+      <applyto>/apps/control-center/appearance/more_themes_url</applyto>
+      <owner>control-center</owner>
+      <type>string</type>
+      <default>http://art.gnome.org/themes/</default>
+      <locale name="C">
+        <short>More themes URL</short>
+        <long>
+          URL for where to get more desktop themes.  If set to an
+          empty string the link will not appear.
+        </long>
+      </locale>
+    </schema>
+    <schema>
       <key>/schemas/apps/control-center/network/current_location</key>
       <applyto>/apps/control-center/network/current_location</applyto>
       <owner>control-center</owner>



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