Re: Showing CC-BY attribution in background chooser

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



On Thu, 2010-09-16 at 11:50 +0200, Martin Sourada wrote:
> Hi,
> 
> we, at the design team, are searching for a way to add attribution to
> wallpapers. We'd like to display it in the tooltip that appears in when
> you hoover over an wallpaper in backgrounds chooser in a similar format
> that KDE does it, e.g.
> 
> <b><wallpaper name></b>
> Author: <author name>
> <basic image info>
> Folder: <path to where the image is>
> 
> As you see, it only adds the 'Author:' line to what already is there. Is
> there some way to do it currently, or would we need to write a patch to
> background chooser?
> 
> Plus, is there any place where I can get the DTD file that's used as
> DOCTYPE in all XMLs in /usr/share/gnome-background-properties:
> <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
> 
> I cannot find it anywhere (hence the reason why I ask if there already
> IS a way)...

Just FYI, I attach a (quick) patch that does this.

Martin
diff -up gnome-control-center-2.31.91/capplets/appearance/gnome-wp-item.c.attribution gnome-control-center-2.31.91/capplets/appearance/gnome-wp-item.c
--- gnome-control-center-2.31.91/capplets/appearance/gnome-wp-item.c.attribution	2010-03-29 16:22:56.000000000 +0200
+++ gnome-control-center-2.31.91/capplets/appearance/gnome-wp-item.c	2010-09-23 13:26:05.000000000 +0200
@@ -278,27 +278,51 @@ void gnome_wp_item_update_description (G
 
     if (description && size) {
       /* translators: <b>wallpaper name</b>
+       * Author: author
        * mime type, size
        * Folder: /path/to/file
        */
-      item->description = g_markup_printf_escaped (_("<b>%s</b>\n"
-                                                     "%s, %s\n"
-                                                     "Folder: %s"),
-                                                   item->name,
-                                                   description,
-                                                   size,
-                                                   dirname);
+      if (item->author)
+        item->description = g_markup_printf_escaped (_("<b>%s</b>\n"
+        					       "Author: %s\n"
+                                                       "%s, %s\n"
+                                                       "Folder: %s"),
+                                                     item->name,
+                                                     item->author,
+                                                     description,
+                                                     size,
+                                                     dirname);
+     else
+        item->description = g_markup_printf_escaped (_("<b>%s</b>\n"
+                                                       "%s, %s\n"
+                                                       "Folder: %s"),
+                                                     item->name,
+                                                     description,
+                                                     size,
+                                                     dirname);
+                                                       
     } else {
       /* translators: <b>wallpaper name</b>
+       * Author: author
        * Image missing
        * Folder: /path/to/file
        */
-      item->description = g_markup_printf_escaped (_("<b>%s</b>\n"
-                                                     "%s\n"
-                                                     "Folder: %s"),
-                                                   item->name,
-                                                   _("Image missing"),
-                                                   dirname);
+      if (item->author)
+        item->description = g_markup_printf_escaped (_("<b>%s</b>\n"
+                                                       "Author: %s\n"
+                                                       "%s\n"
+                                                       "Folder: %s"),
+                                                     item->name,
+                                                     item->author,
+                                                     _("Image missing"),
+                                                     dirname);
+      else
+        item->description = g_markup_printf_escaped (_("<b>%s</b>\n"
+                                                       "%s\n"
+                                                       "Folder: %s"),
+                                                     item->name,
+                                                     _("Image missing"),
+                                                     dirname);      
     }
 
     g_free (size);
diff -up gnome-control-center-2.31.91/capplets/appearance/gnome-wp-item.h.attribution gnome-control-center-2.31.91/capplets/appearance/gnome-wp-item.h
--- gnome-control-center-2.31.91/capplets/appearance/gnome-wp-item.h.attribution	2010-01-26 09:46:31.000000000 +0100
+++ gnome-control-center-2.31.91/capplets/appearance/gnome-wp-item.h	2010-09-23 13:20:15.000000000 +0200
@@ -43,6 +43,7 @@ struct _GnomeWPItem {
   GnomeBG *bg;
 
   gchar * name;
+  gchar * author;
   gchar * filename;
   gchar * description;
   GnomeBGPlacement options;
diff -up gnome-control-center-2.31.91/capplets/appearance/gnome-wp-xml.c.attribution gnome-control-center-2.31.91/capplets/appearance/gnome-wp-xml.c
--- gnome-control-center-2.31.91/capplets/appearance/gnome-wp-xml.c.attribution	2009-09-07 13:19:06.000000000 +0200
+++ gnome-control-center-2.31.91/capplets/appearance/gnome-wp-xml.c	2010-09-23 13:20:55.000000000 +0200
@@ -163,6 +163,26 @@ static void gnome_wp_xml_load_xml (Appea
 	  } else {
 	    break;
 	  }
+	} else if (!strcmp ((gchar *)wpa->name, "author")) {
+	  if (wpa->last != NULL && wpa->last->content != NULL) {
+	    nodelang = xmlNodeGetLang (wpa->last);
+
+	    if (wp->author == NULL && nodelang == NULL) {
+	       wp->author = g_strdup (g_strstrip ((gchar *)wpa->last->content));
+            } else {
+	       for (i = 0; syslangs[i] != NULL; i++) {
+	         if (!strcmp (syslangs[i], (gchar *)nodelang)) {
+	           g_free (wp->author);
+	           wp->author = g_strdup (g_strstrip ((gchar *)wpa->last->content));
+	           break;
+	         }
+	       }
+	    }
+
+	    xmlFree (nodelang);
+	  } else {
+	    break;
+	  }
 	} else if (!strcmp ((gchar *)wpa->name, "options")) {
 	  if (wpa->last != NULL) {
 	    wp->options = wp_item_string_to_option (g_strstrip ((gchar *)wpa->last->content));

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
desktop mailing list
desktop@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/desktop

[Index of Archives]     [Fedora Users]     [Fedora KDE]     [Fedora Announce]     [Fedora Docs]     [Fedora Config]     [PAM]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux