[Gpa-commits] r873 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Apr 9 22:51:14 CEST 2008


Author: marcus
Date: 2008-04-09 22:51:11 +0200 (Wed, 09 Apr 2008)
New Revision: 873

Modified:
   trunk/src/ChangeLog
   trunk/src/icons.c
   trunk/src/icons.h
   trunk/src/keylist.c
Log:
2008-04-09  Marcus Brinkmann  <marcus at g10code.de>

	* keylist.c (setup_columns): Change attribute of
	GPA_KEYLIST_COLUMN_IMAGE from "pixbuf" to "stock-id".
	(get_key_pixbuf): Change return type to const gchar * and return
	stock item IDs.
	(gpa_keylist_constructor): Set type of first column to
	G_TYPE_STRING.
	(setup_columns): Set stock-size property of RENDERER, and use the
	stock-id property for that tree view column renderer.
	* icons.c (xpms): Use stock IDs for secret and public key.
	(register_stock_icons): Set fixed sizes for the secret and public
	key icons.
	* icons.h (GPA_STOCK_PUBLIC_KEY, GPA_STOCK_SECRET_KEY): New.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-04-03 13:23:04 UTC (rev 872)
+++ trunk/src/ChangeLog	2008-04-09 20:51:11 UTC (rev 873)
@@ -1,3 +1,18 @@
+2008-04-09  Marcus Brinkmann  <marcus at g10code.de>
+
+	* keylist.c (setup_columns): Change attribute of
+	GPA_KEYLIST_COLUMN_IMAGE from "pixbuf" to "stock-id".
+	(get_key_pixbuf): Change return type to const gchar * and return
+	stock item IDs.
+	(gpa_keylist_constructor): Set type of first column to
+	G_TYPE_STRING.
+	(setup_columns): Set stock-size property of RENDERER, and use the
+	stock-id property for that tree view column renderer.
+	* icons.c (xpms): Use stock IDs for secret and public key.
+	(register_stock_icons): Set fixed sizes for the secret and public
+	key icons.
+	* icons.h (GPA_STOCK_PUBLIC_KEY, GPA_STOCK_SECRET_KEY): New.
+
 2008-04-03  Marcus Brinkmann  <marcus at g10code.de>
 
 	* gpa.h (gpa_windows_menu_action_entries): Use stock items for

Modified: trunk/src/icons.c
===================================================================
--- trunk/src/icons.c	2008-04-03 13:23:04 UTC (rev 872)
+++ trunk/src/icons.c	2008-04-09 20:51:11 UTC (rev 873)
@@ -70,15 +70,14 @@
   { GPA_STOCK_KEYRING_EDITOR, keyring_xpm },
   { "gpa_blue_key", gpa_blue_key_xpm },
   { "gpa_yellow_key", gpa_yellow_key_xpm },
-  { "blue_key",	blue_key_xpm },
-  { "blue_yellow_key", blue_yellow_key_xpm },
+  { GPA_STOCK_PUBLIC_KEY, blue_key_xpm },
+  { GPA_STOCK_SECRET_KEY, blue_yellow_key_xpm },
   { "wizard_genkey", wizard_genkey_xpm},
   { "wizard_backup", wizard_backup_xpm},
   { NULL, NULL }
 };
 
 
-
 static GdkPixmap *
 pixmap_for_icon (GtkWidget *window, const char *name, GdkBitmap **r_mask)
 {
@@ -158,7 +157,17 @@
 
       pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) xpms[i].xpm);
       gtk_icon_source_set_pixbuf (icon_source, pixbuf);
-	
+      gtk_icon_source_set_direction_wildcarded (icon_source, TRUE);
+      gtk_icon_source_set_state_wildcarded (icon_source, TRUE);
+      if (! strcmp (xpms[i].name, GPA_STOCK_PUBLIC_KEY)
+	  || ! strcmp (xpms[i].name, GPA_STOCK_SECRET_KEY))
+	{
+	  /* FIXME: For the keylist icons, we disable scaling for now
+	     for best visual results.  */
+	  gtk_icon_source_set_size_wildcarded (icon_source, FALSE);
+	  gtk_icon_source_set_size (icon_source, GTK_ICON_SIZE_LARGE_TOOLBAR);
+	}
+
       gtk_icon_set_add_source (icon_set, icon_source);
       gtk_icon_source_free (icon_source);
       gtk_icon_factory_add (icon_factory, xpms[i].name, icon_set);

Modified: trunk/src/icons.h
===================================================================
--- trunk/src/icons.h	2008-04-03 13:23:04 UTC (rev 872)
+++ trunk/src/icons.h	2008-04-09 20:51:11 UTC (rev 873)
@@ -47,5 +47,8 @@
 #define GPA_STOCK_IMPORT "gpa-import"
 #define GPA_STOCK_EXPORT "gpa-export"
 #define GPA_STOCK_BACKUP "gpa-backup"
+
+#define GPA_STOCK_SECRET_KEY "gpa-secret-key"
+#define GPA_STOCK_PUBLIC_KEY "gpa-public-key"
      
 #endif /*ICONS_H*/

Modified: trunk/src/keylist.c
===================================================================
--- trunk/src/keylist.c	2008-04-03 13:23:04 UTC (rev 872)
+++ trunk/src/keylist.c	2008-04-09 20:51:11 UTC (rev 873)
@@ -186,13 +186,13 @@
 
    /* Init the model */
   store = gtk_list_store_new (GPA_KEYLIST_N_COLUMNS,
-			      GDK_TYPE_PIXBUF,
 			      G_TYPE_STRING,
 			      G_TYPE_STRING,
 			      G_TYPE_STRING,
 			      G_TYPE_STRING,
 			      G_TYPE_STRING,
 			      G_TYPE_STRING,
+			      G_TYPE_STRING,
 			      G_TYPE_POINTER,
 			      G_TYPE_INT,
 			      G_TYPE_ULONG,
@@ -366,30 +366,14 @@
 }
 
 
-static GdkPixbuf*
+static const gchar *
 get_key_pixbuf (gpgme_key_t key)
 {
-  static gboolean pixmaps_created = FALSE;
-  static GdkPixbuf *secret_pixbuf = NULL;
-  static GdkPixbuf *public_pixbuf = NULL;
-
-  if (!pixmaps_created)
-    {
-      secret_pixbuf = gpa_create_icon_pixbuf ("blue_yellow_key");
-      public_pixbuf = gpa_create_icon_pixbuf ("blue_key");
-      pixmaps_created = TRUE;
-    }
-
-  if (gpa_keytable_lookup_key 
-      (gpa_keytable_get_secret_instance(), 
-       key->subkeys->fpr) != NULL)
-    {
-      return secret_pixbuf;
-    }
+  if (gpa_keytable_lookup_key (gpa_keytable_get_secret_instance (),
+			       key->subkeys->fpr) != NULL)
+    return GPA_STOCK_SECRET_KEY;
   else
-    {
-      return public_pixbuf;
-    }
+    return GPA_STOCK_PUBLIC_KEY;
 }
 
 
@@ -493,12 +477,12 @@
 		      key->subkeys->expires : G_MAXULONG,
 		      GPA_KEYLIST_COLUMN_OWNERTRUST_VALUE, 
 		      key->owner_trust,
-		      /* Set revoked and expired keys to "never trust" for 
-		       * sorting */
+		      /* Set revoked and expired keys to "never trust"
+		         for sorting.  */
 		      GPA_KEYLIST_COLUMN_VALIDITY_VALUE, val_value,
                       /* Store the image only if enabled.  */
-		      list->public_only? -1: GPA_KEYLIST_COLUMN_IMAGE,
-                      list->public_only? NULL:get_key_pixbuf (key),
+		      list->public_only ? -1 : GPA_KEYLIST_COLUMN_IMAGE,
+                      list->public_only ? NULL : get_key_pixbuf (key),
 		      -1);
   /* Clean up */
   g_free (userid);
@@ -540,9 +524,13 @@
   if (!keylist->public_only)
     {
       renderer = gtk_cell_renderer_pixbuf_new ();
+      /* Large toolbar size is 24x24, which is large enough to
+	 accomodate the key icons.  Note that those are at fixed size
+	 and thus no scaling or padding is done (see icons.c).  */
+      g_object_set (renderer, "stock-size", GTK_ICON_SIZE_LARGE_TOOLBAR, NULL);
+
       column = gtk_tree_view_column_new_with_attributes 
-        ("", renderer,
-         "pixbuf",
+        (NULL, renderer, "stock-id",
          GPA_KEYLIST_COLUMN_IMAGE,
          NULL);
       gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);



More information about the Gpa-commits mailing list