[Gpa-commits] r838 - trunk/src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Mar 6 23:16:51 CET 2008
Author: werner
Date: 2008-03-06 23:16:51 +0100 (Thu, 06 Mar 2008)
New Revision: 838
Modified:
trunk/src/ChangeLog
trunk/src/keylist.c
trunk/src/recipientdlg.c
Log:
Add tooltips to the column headers.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2008-03-06 19:42:46 UTC (rev 837)
+++ trunk/src/ChangeLog 2008-03-06 22:16:51 UTC (rev 838)
@@ -15,6 +15,9 @@
(gpa_keylist_init): Make a dummy fucntion and move all stuff to ..
(gpa_keylist_constructor): .. New.
(gpa_keylist_class_init): Register constructor.
+ (gpa_keylist_set_detailed, gpa_keylist_set_brief): Merged into ..
+ (setup_columns): .. new. Add toolstips.
+ (add_tooltip, set_column_title): New.
* keylist.h (_GpaKeyList): Add field public_only.
* selectkeydlg.h, selectkeydlg.c: New.
Modified: trunk/src/keylist.c
===================================================================
--- trunk/src/keylist.c 2008-03-06 19:42:46 UTC (rev 837)
+++ trunk/src/keylist.c 2008-03-06 22:16:51 UTC (rev 838)
@@ -420,40 +420,31 @@
}
}
-
-
-/************************************************************
- ********************** Public API ************************
- ************************************************************/
-
-/* Create a new key list widget. */
-GtkWidget *
-gpa_keylist_new (GtkWidget *window)
+static void
+add_tooltip (GtkWidget *widget, const char *text)
{
- GtkWidget *list = (GtkWidget*) g_object_new (GPA_KEYLIST_TYPE, NULL);
-
- return list;
+#if GTK_CHECK_VERSION (2, 12, 0)
+ if (widget && text && *text)
+ gtk_widget_set_tooltip_text (widget, text);
+#endif
}
-
-/* Create a new key list widget in public_only mode. */
-GpaKeyList *
-gpa_keylist_new_public_only (GtkWidget *window)
+static void
+set_column_title (GtkTreeViewColumn *column,
+ const char *title, const char *tooltip)
{
- GpaKeyList *list;
+ GtkWidget *label;
- list = g_object_new (GPA_KEYLIST_TYPE,
- "public-only", TRUE,
- NULL);
-
- return list;
+ label = gtk_label_new (title);
+ /* We need to show the label before setting the widget. */
+ gtk_widget_show (label);
+ gtk_tree_view_column_set_widget (column, label);
+ add_tooltip (gtk_tree_view_column_get_widget (column), tooltip);
}
-
-/* Set the key list in "brief" mode. */
-void
-gpa_keylist_set_brief (GpaKeyList *keylist)
+static void
+setup_columns (GpaKeyList *keylist, gboolean detailed)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
@@ -464,106 +455,125 @@
{
renderer = gtk_cell_renderer_pixbuf_new ();
column = gtk_tree_view_column_new_with_attributes
- ("", renderer, "pixbuf", GPA_KEYLIST_COLUMN_IMAGE, NULL);
+ ("", renderer,
+ "pixbuf",
+ GPA_KEYLIST_COLUMN_IMAGE,
+ NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
- gtk_tree_view_column_set_sort_column_id (column,
- GPA_KEYLIST_COLUMN_HAS_SECRET);
+ gtk_tree_view_column_set_sort_column_id
+ (column, GPA_KEYLIST_COLUMN_HAS_SECRET);
gtk_tree_view_column_set_sort_indicator (column, TRUE);
}
renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Key ID"), renderer,
- "text",
- GPA_KEYLIST_COLUMN_KEYID,
- NULL);
+ column = gtk_tree_view_column_new_with_attributes
+ (NULL, renderer, "text", GPA_KEYLIST_COLUMN_KEYID, NULL);
+ set_column_title
+ (column, _("Key ID"),
+ _("The key ID is a short number to identify a certificate."));
gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
gtk_tree_view_column_set_sort_column_id (column, GPA_KEYLIST_COLUMN_KEYID);
gtk_tree_view_column_set_sort_indicator (column, TRUE);
+ if (detailed)
+ {
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes
+ (NULL, renderer, "text", GPA_KEYLIST_COLUMN_EXPIRY, NULL);
+ set_column_title
+ (column, _("Expiry Date"),
+ _("The Expiry Date is the date until the certificate is valid."));
+ gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
+ gtk_tree_view_column_set_sort_column_id
+ (column, GPA_KEYLIST_COLUMN_EXPIRY_TS);
+ gtk_tree_view_column_set_sort_indicator (column, TRUE);
+
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes
+ (NULL, renderer, "text", GPA_KEYLIST_COLUMN_OWNERTRUST, NULL);
+ set_column_title
+ (column, _("Owner Trust"),
+ _("The Owner Trust has been set by you and describes how far you"
+ " trust the holder of the certificate to correctly sign (certify)"
+ " other certificates. It is only meaningful for OpenPGP."));
+ gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
+ gtk_tree_view_column_set_sort_column_id
+ (column, GPA_KEYLIST_COLUMN_OWNERTRUST_VALUE);
+ gtk_tree_view_column_set_sort_indicator (column, TRUE);
+
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes
+ (NULL, renderer, "text", GPA_KEYLIST_COLUMN_VALIDITY, NULL);
+ set_column_title
+ (column, _("Validity"),
+ _("The Validity describes the trust level the system has"
+ " in this certificate. That is how sure it is that the named"
+ " user is actually that user."));
+ gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
+ gtk_tree_view_column_set_sort_column_id
+ (column, GPA_KEYLIST_COLUMN_VALIDITY_VALUE);
+ gtk_tree_view_column_set_sort_indicator (column, TRUE);
+ }
+
renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (_("User Name"), renderer,
- "text",
- GPA_KEYLIST_COLUMN_USERID,
- NULL);
+ column = gtk_tree_view_column_new_with_attributes
+ (NULL, renderer, "text", GPA_KEYLIST_COLUMN_USERID, NULL);
+ set_column_title
+ (column, _("User Name"),
+ _("The User Name is the name and often also the email address "
+ " of the certificate."));
gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
gtk_tree_view_column_set_sort_column_id (column, GPA_KEYLIST_COLUMN_USERID);
gtk_tree_view_column_set_sort_indicator (column, TRUE);
}
-/* Set the key list in "detailed" mode. */
-void
-gpa_keylist_set_detailed (GpaKeyList * keylist)
+
+/************************************************************
+ ********************** Public API ************************
+ ************************************************************/
+
+/* Create a new key list widget. */
+GtkWidget *
+gpa_keylist_new (GtkWidget *window)
{
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
+ GtkWidget *list = (GtkWidget*) g_object_new (GPA_KEYLIST_TYPE, NULL);
- gpa_keylist_clear_columns (keylist);
+ return list;
+}
- if (!keylist->public_only)
- {
- renderer = gtk_cell_renderer_pixbuf_new ();
- column = gtk_tree_view_column_new_with_attributes
- ("", renderer,
- "pixbuf",
- GPA_KEYLIST_COLUMN_IMAGE,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
- gtk_tree_view_column_set_sort_column_id
- (column, GPA_KEYLIST_COLUMN_HAS_SECRET);
- gtk_tree_view_column_set_sort_indicator (column, TRUE);
- }
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Key ID"), renderer,
- "text",
- GPA_KEYLIST_COLUMN_KEYID,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
- gtk_tree_view_column_set_sort_column_id (column, GPA_KEYLIST_COLUMN_KEYID);
- gtk_tree_view_column_set_sort_indicator (column, TRUE);
+/* Create a new key list widget in public_only mode. */
+GpaKeyList *
+gpa_keylist_new_public_only (GtkWidget *window)
+{
+ GpaKeyList *list;
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Expiry Date"),
- renderer,
- "text",
- GPA_KEYLIST_COLUMN_EXPIRY,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
- gtk_tree_view_column_set_sort_column_id (column, GPA_KEYLIST_COLUMN_EXPIRY_TS);
- gtk_tree_view_column_set_sort_indicator (column, TRUE);
+ list = g_object_new (GPA_KEYLIST_TYPE,
+ "public-only", TRUE,
+ NULL);
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Owner Trust"),
- renderer,
- "text",
- GPA_KEYLIST_COLUMN_OWNERTRUST,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
- gtk_tree_view_column_set_sort_column_id (column, GPA_KEYLIST_COLUMN_OWNERTRUST_VALUE);
- gtk_tree_view_column_set_sort_indicator (column, TRUE);
+ return list;
+}
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (_("Key Validity"),
- renderer,
- "text",
- GPA_KEYLIST_COLUMN_VALIDITY,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
- gtk_tree_view_column_set_sort_column_id (column, GPA_KEYLIST_COLUMN_VALIDITY_VALUE);
- gtk_tree_view_column_set_sort_indicator (column, TRUE);
- renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (_("User Name"), renderer,
- "text",
- GPA_KEYLIST_COLUMN_USERID,
- NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW (keylist), column);
- gtk_tree_view_column_set_sort_column_id (column, GPA_KEYLIST_COLUMN_USERID);
- gtk_tree_view_column_set_sort_indicator (column, TRUE);
+
+/* Set the key list in "brief" mode. */
+void
+gpa_keylist_set_brief (GpaKeyList *keylist)
+{
+ setup_columns (keylist, FALSE);
}
+/* Set the key list in "detailed" mode. */
+void
+gpa_keylist_set_detailed (GpaKeyList * keylist)
+{
+ setup_columns (keylist, TRUE);
+}
+
+
/* Return true if any key is selected in the list. */
gboolean
gpa_keylist_has_selection (GpaKeyList * keylist)
Modified: trunk/src/recipientdlg.c
===================================================================
--- trunk/src/recipientdlg.c 2008-03-06 19:42:46 UTC (rev 837)
+++ trunk/src/recipientdlg.c 2008-03-06 22:16:51 UTC (rev 838)
@@ -180,7 +180,7 @@
/* Define the columns. */
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes
- (_("Recipient"), renderer, "markup", RECPLIST_MAILBOX, NULL);
+ (NULL, renderer, "markup", RECPLIST_MAILBOX, NULL);
set_column_title (column, _("Recipient"),
_("Shows the recipients of the message."
" A key needs to be assigned to each recipient."));
More information about the Gpa-commits
mailing list