[Gpa-commits] r928 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jan 8 19:30:08 CET 2009


Author: marcus
Date: 2009-01-08 19:30:07 +0100 (Thu, 08 Jan 2009)
New Revision: 928

Modified:
   trunk/src/ChangeLog
   trunk/src/cardman.c
Log:
2009-01-08  Marcus Brinkmann  <marcus at g10code.de>

	* cardman.c (struct _GpaCardManager): New members status_label,
	status_text.
	(cardman_statusbar_new, cardman_statusbar_update): New functions.
	(update_info_visibility): Call cardman_statusbar_update.
	(cardman_action_new): Add edit menu, and preferences to toolbar.
	(ADD_TABLE_ROW): Expand the second column.  Left-align the label.
	(gpa_card_manager_constructor): Add status bar to main window.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-01-07 16:34:52 UTC (rev 927)
+++ trunk/src/ChangeLog	2009-01-08 18:30:07 UTC (rev 928)
@@ -1,3 +1,13 @@
+2009-01-08  Marcus Brinkmann  <marcus at g10code.de>
+
+	* cardman.c (struct _GpaCardManager): New members status_label,
+	status_text.
+	(cardman_statusbar_new, cardman_statusbar_update): New functions.
+	(update_info_visibility): Call cardman_statusbar_update.
+	(cardman_action_new): Add edit menu, and preferences to toolbar.
+	(ADD_TABLE_ROW): Expand the second column.  Left-align the label.
+	(gpa_card_manager_constructor): Add status bar to main window.
+
 2009-01-07  Marcus Brinkmann  <marcus at g10code.de>
 
 	* cardman.c (card_reload_cb): Nul-terminate the version string.

Modified: trunk/src/cardman.c
===================================================================
--- trunk/src/cardman.c	2009-01-07 16:34:52 UTC (rev 927)
+++ trunk/src/cardman.c	2009-01-08 18:30:07 UTC (rev 928)
@@ -69,6 +69,11 @@
   GtkWidget *entryKeySig;
   GtkWidget *entryKeyEnc;
   GtkWidget *entryKeyAuth;
+
+  /* Labels in the status bar.  */
+  GtkWidget *status_label;
+  GtkWidget *status_text;
+
 #if 0
   GtkWidget *comboSex;
   GList *selection_sensitive_actions; /* ? */
@@ -107,7 +112,40 @@
  *******************   Implementation   *********************
  ************************************************************/
 
+/* Status bar handling.  */
+
+static GtkWidget *
+cardman_statusbar_new (GpaCardManager *cardman)
+{
+  GtkWidget *align;
+  GtkWidget *hbox;
+  GtkWidget *label;
+
+  hbox = gtk_hbox_new (FALSE, 0);
+ 
+  label = gtk_label_new (_("Status: "));
+  cardman->status_label = label;
+  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+  label = gtk_label_new ("");
+  cardman->status_text = label;
+  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 5);
+  
+  align = gtk_alignment_new (0, 1, 1, 0);
+  gtk_container_add (GTK_CONTAINER (align), hbox);
+
+  return align;
+}
+
+
 static void
+cardman_statusbar_update (GpaCardManager *cardman, const char *text)
+{
+  gtk_label_set_text (GTK_LABEL (cardman->status_text), text);
+}
+
+
+static void
 update_title (GpaCardManager *cardman)
 {
   const char *title = _("GNU Privacy Assistant - Card Manager");
@@ -128,9 +166,15 @@
 update_info_visibility (GpaCardManager *cardman)
 {
   if (cardman->have_card)
-    gtk_widget_show_all (cardman->card_widget);
+    {
+      cardman_statusbar_update (cardman, _("Smart card detected."));
+      gtk_widget_show_all (cardman->card_widget);
+    }
   else
-    gtk_widget_hide_all (cardman->card_widget);
+    {
+      cardman_statusbar_update (cardman, _("Checking for smart card..."));
+      gtk_widget_hide_all (cardman->card_widget);
+    }
 }
 
 
@@ -294,6 +338,7 @@
     {
       /* Toplevel.  */
       { "File", NULL, N_("_File"), NULL },
+      { "Edit", NULL, N_("_Edit"), NULL },
       { "Card", NULL, N_("_Card"), NULL },
 
       /* File menu.  */
@@ -318,6 +363,10 @@
     "    <menu action='File'>"
     "      <menuitem action='FileQuit'/>"
     "    </menu>"
+    "    <menu action='Edit'>"
+    "      <menuitem action='EditPreferences'/>"
+    "      <menuitem action='EditBackendPreferences'/>"
+    "    </menu>"
     "    <menu action='Card'>"
     "      <menuitem action='CardReload'/>"
 #if 0
@@ -344,6 +393,8 @@
     "    <toolitem action='CardEdit'/>"
 #endif
     "    <separator/>"
+    "    <toolitem action='EditPreferences'/>"
+    "    <separator/>"
     "    <toolitem action='WindowsKeyringEditor'/>"
     "    <toolitem action='WindowsFileManager'/>"
     "    <toolitem action='WindowsClipboard'/>"
@@ -412,15 +463,17 @@
 
   table = gtk_table_new (4, 2, FALSE);
   gtk_container_set_border_width (GTK_CONTAINER (table), 5);
-
-#define ADD_TABLE_ROW(label, widget) \
-  { \
-    GtkWidget *tmp_label = gtk_label_new (_(label)); \
-    gtk_table_attach (GTK_TABLE (table), tmp_label, 0, 1, \
+  
+#define ADD_TABLE_ROW(label, widget)				       \
+  {								       \
+    GtkWidget *tmp_label = gtk_label_new (_(label));		       \
+    gtk_misc_set_alignment (GTK_MISC (tmp_label), 0, 0.5);	       \
+    gtk_table_attach (GTK_TABLE (table), tmp_label, 0, 1,	       \
                       rowidx, rowidx + 1, GTK_FILL, GTK_SHRINK, 0, 0); \
-    gtk_table_attach (GTK_TABLE (table), widget, 1, 2, \
-                      rowidx, rowidx + 1, GTK_FILL, GTK_SHRINK, 0, 0); \
-    rowidx++; \
+    gtk_table_attach (GTK_TABLE (table), widget, 1, 2,		       \
+                      rowidx, rowidx + 1, GTK_FILL | GTK_EXPAND,       \
+		      GTK_SHRINK, 0, 0);			       \
+    rowidx++;							       \
   }
   
   cardman->entrySerialno = gtk_entry_new ();
@@ -483,7 +536,6 @@
 }
 
 
-
 
 /************************************************************ 
  ******************   Object Management  ********************
@@ -523,6 +575,7 @@
   gchar *markup;
   GtkWidget *menubar;
   GtkWidget *toolbar;
+  GtkWidget *statusbar;
 
   /* Invoke parent's constructor.  */
   object = parent_class->constructor (type,
@@ -580,6 +633,9 @@
   cardman->card_widget = construct_card_widget (cardman);
   gtk_box_pack_start (GTK_BOX (vbox), cardman->card_widget, TRUE, TRUE, 0);
 
+  statusbar = cardman_statusbar_new (cardman);
+  gtk_box_pack_start (GTK_BOX (vbox), statusbar, TRUE, TRUE, 0);
+
   gtk_container_add (GTK_CONTAINER (cardman), vbox);
 
   g_signal_connect (object, "destroy",



More information about the Gpa-commits mailing list