[Gpa-commits] r881 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri May 2 19:14:37 CEST 2008


Author: werner
Date: 2008-05-02 19:14:37 +0200 (Fri, 02 May 2008)
New Revision: 881

Modified:
   trunk/src/ChangeLog
   trunk/src/filesigndlg.c
   trunk/src/gpa.c
   trunk/src/gpgmetools.c
   trunk/src/keygendlg.c
   trunk/src/passwddlg.c
   trunk/src/server.c
   trunk/src/settingsdlg.c
   trunk/src/settingsdlg.h
Log:
More work on the settings dialog.
Commit missing button order changes.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-05-02 13:48:40 UTC (rev 880)
+++ trunk/src/ChangeLog	2008-05-02 17:14:37 UTC (rev 881)
@@ -1,5 +1,10 @@
 2008-05-02  Werner Koch  <wk at g10code.com>
 
+	* gpa.c (option_entries): Add option --settings.
+	(main): Start settings dialog if requested.
+
+	* server.c (cmd_sender): Update SENDER to allow for options.
+
 	* settingsdlg.c, settingsdlg.h: Start a rewrite.
 	* gpa.c (gpa_open_settings_dialog): Adjust for the rewrite.
 	(settings_dialog): Remove.

Modified: trunk/src/filesigndlg.c
===================================================================
--- trunk/src/filesigndlg.c	2008-05-02 13:48:40 UTC (rev 880)
+++ trunk/src/filesigndlg.c	2008-05-02 17:14:37 UTC (rev 881)
@@ -128,8 +128,13 @@
 
   /* Set up the dialog */
   gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+			  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 			  GTK_STOCK_OK, GTK_RESPONSE_OK,
-			  _("_Cancel"), GTK_RESPONSE_CANCEL, NULL);
+                          NULL);
+  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+                                           GTK_RESPONSE_OK,
+                                           GTK_RESPONSE_CANCEL,
+                                           -1);
   gtk_window_set_title (GTK_WINDOW (dialog), _("Sign documents"));
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);

Modified: trunk/src/gpa.c
===================================================================
--- trunk/src/gpa.c	2008-05-02 13:48:40 UTC (rev 880)
+++ trunk/src/gpa.c	2008-05-02 17:14:37 UTC (rev 881)
@@ -60,6 +60,7 @@
   gboolean start_keyring_editor;
   gboolean start_file_manager;
   gboolean start_clipboard;
+  gboolean start_settings;
   gboolean start_only_server;
   gchar *options_filename;
 } gpa_args_t;
@@ -95,8 +96,10 @@
       N_("Open file manager"), NULL },
     { "clipboard", 'c', 0, G_OPTION_ARG_NONE, &args.start_clipboard,
       N_("Open clipboard"), NULL },
+    { "settings", 's', 0, G_OPTION_ARG_NONE, &args.start_settings,
+      N_("Open the settings dialog"), NULL },
     { "daemon", 'd', 0, G_OPTION_ARG_NONE, &args.start_only_server,
-      N_("Start only the UI server (implies --cms)"), NULL },
+      N_("Enable the UI server (implies --cms)"), NULL },
     { "options", 'o', 0, G_OPTION_ARG_FILENAME, &args.options_filename,
       N_("Read options from file"), "FILE" },
     { "cms", 'x', 0, G_OPTION_ARG_NONE, &cms_hack,
@@ -154,7 +157,7 @@
 }
 
 
-/* Manage the two main windows and the settings dialog.  */
+/* Manage the main windows and the settings dialog.  */
 static void
 quit_if_no_window (void)
 {
@@ -358,7 +361,7 @@
   }
 #endif
 
-  /* Prefer gpg2 over gpg1.  Fixme: We need to test where gpg2 is
+  /* Prefer gpg2 over gpg1.  Fixme: We need to test whether gpg2 is
      actually properly installed.  */
   if (!access ("/usr/local/bin/gpg2", X_OK))
     gpgme_set_engine_info (GPGME_PROTOCOL_OpenPGP, 
@@ -375,7 +378,7 @@
 
   /* Start the keyring editor by default.  */
   if (!args.start_keyring_editor && !args.start_file_manager
-      && !args.start_clipboard)
+      && !args.start_clipboard && !args.start_settings)
     args.start_keyring_editor = TRUE;
 
   /* Note: We can not use GPGME's engine info, as that returns NULL
@@ -420,7 +423,7 @@
   else
     {
       /* Don't open the keyring editor if any files are given on the
-         command line.  Dito for the clipboard.   */
+         command line.  Ditto for the clipboard.   */
       if (args.start_keyring_editor && (optind >= argc))
 	gpa_open_keyring_editor (NULL, NULL);
 
@@ -430,6 +433,9 @@
       if (args.start_file_manager || (optind < argc))
 	gpa_open_filemanager (NULL, NULL);
 
+      if (args.start_settings)
+	gpa_open_settings_dialog (NULL, NULL);
+
       /* If there are any command line arguments that are not options,
 	 try to open them as files in the filemanager */
       for (i = optind; i < argc; i++)
@@ -442,3 +448,4 @@
 
   return 0;
 }
+

Modified: trunk/src/gpgmetools.c
===================================================================
--- trunk/src/gpgmetools.c	2008-05-02 13:48:40 UTC (rev 880)
+++ trunk/src/gpgmetools.c	2008-05-02 17:14:37 UTC (rev 881)
@@ -699,11 +699,14 @@
   
   dialog = gtk_dialog_new_with_buttons (_("Enter Passphrase"),
 					NULL, GTK_DIALOG_MODAL,
-					GTK_STOCK_OK,
-					GTK_RESPONSE_OK,
-                                        _("_Cancel"),
-					GTK_RESPONSE_CANCEL,
+                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+					GTK_STOCK_OK, GTK_RESPONSE_OK,
 					NULL);
+  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+                                           GTK_RESPONSE_OK,
+                                           GTK_RESPONSE_CANCEL,
+                                           -1);
+
   hbox = gtk_hbox_new (FALSE, 0);
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, 
 		      TRUE, FALSE, 10);

Modified: trunk/src/keygendlg.c
===================================================================
--- trunk/src/keygendlg.c	2008-05-02 13:48:40 UTC (rev 880)
+++ trunk/src/keygendlg.c	2008-05-02 17:14:37 UTC (rev 881)
@@ -146,14 +146,16 @@
 
   GPAKeyGenAlgo algo;
 
-  windowGenerate = gtk_dialog_new_with_buttons (_("Generate key"),
-                                                GTK_WINDOW (parent),
-                                                GTK_DIALOG_MODAL,
-                                                GTK_STOCK_OK,
-                                                GTK_RESPONSE_OK,
-                                                _("_Cancel"),
-                                                GTK_RESPONSE_CANCEL,
-                                                NULL);
+  windowGenerate = gtk_dialog_new_with_buttons
+    (_("Generate key"), GTK_WINDOW (parent),
+     GTK_DIALOG_MODAL,
+     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+     GTK_STOCK_OK, GTK_RESPONSE_OK,
+     NULL);
+  gtk_dialog_set_alternative_button_order (GTK_DIALOG (windowGenerate),
+                                           GTK_RESPONSE_OK,
+                                           GTK_RESPONSE_CANCEL,
+                                           -1);
   gtk_dialog_set_default_response (GTK_DIALOG (windowGenerate),
                                    GTK_RESPONSE_OK);
   dialog.window = windowGenerate;

Modified: trunk/src/passwddlg.c
===================================================================
--- trunk/src/passwddlg.c	2008-05-02 13:48:40 UTC (rev 880)
+++ trunk/src/passwddlg.c	2008-05-02 17:14:37 UTC (rev 881)
@@ -95,10 +95,13 @@
 
   dialog = gtk_dialog_new_with_buttons (_("Choose new passphrase"), NULL,
                                         GTK_DIALOG_MODAL,
-                                        GTK_STOCK_OK,
-                                        GTK_RESPONSE_OK,
-                                        _("_Cancel"),
-                                        GTK_RESPONSE_CANCEL, NULL);
+                                        GTK_STOCK_OK, GTK_RESPONSE_OK,
+                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                        NULL);
+  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+                                           GTK_RESPONSE_OK,
+                                           GTK_RESPONSE_CANCEL,
+                                           -1);
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
   vbox = GTK_DIALOG (dialog)->vbox;
   table = gtk_table_new (2, 2, FALSE);

Modified: trunk/src/server.c
===================================================================
--- trunk/src/server.c	2008-05-02 13:48:40 UTC (rev 880)
+++ trunk/src/server.c	2008-05-02 17:14:37 UTC (rev 881)
@@ -80,8 +80,10 @@
   /* The protocol as selected by the user.  */
   gpgme_protocol_t selected_protocol;
 
-  /* The current sender address (malloced). */
+  /* The current sender address (malloced) and a flag telleing whether
+     the sender ist just informational. */
   gchar *sender;
+  int sender_just_info;
 };
 
 
@@ -127,7 +129,7 @@
           && (!s[n] || spacep (s+n) || s[n] == '=')) ? (s+n) : NULL;
 }
 
-/* Check whether LINE coontains the option NAME.  */
+/* Check whether LINE contains the option NAME.  */
 static int
 has_option (const char *line, const char *name)
 {
@@ -553,6 +555,9 @@
   conn_ctrl_t ctrl = assuan_get_pointer (ctx);
   gpg_error_t err = 0;
 
+  ctrl->sender_just_info = has_option (line, "--info");
+  line = skip_options (line);
+
   xfree (ctrl->sender);
   ctrl->sender = NULL;
   if (*line)

Modified: trunk/src/settingsdlg.c
===================================================================
--- trunk/src/settingsdlg.c	2008-05-02 13:48:40 UTC (rev 880)
+++ trunk/src/settingsdlg.c	2008-05-02 17:14:37 UTC (rev 881)
@@ -58,8 +58,27 @@
 {
   GtkDialog parent;
   
-  GtkWidget *foo;
+  /* Data for the user interface frame.  */
+  struct {
+    GtkWidget *frame;
+    GtkToggleButton *advanced_mode;
+    GtkToggleButton *show_advanced_options;
+  } ui;
 
+  /* Data for the keyserver frame.  */
+  struct {
+    GtkWidget *frame;
+    GtkWidget *combo;
+  } keyserver;
+
+  /* Data for the auto-key-locate frame.  */
+  struct {
+    GtkWidget *frame;
+    GtkWidget *addr_hbox;
+    GtkEntry  *addr_entry;
+    GtkComboBox *methods;
+  } akl;
+
 };
 
 struct _SettingsDlgClass 
@@ -79,8 +98,7 @@
 /* Identifiers for our properties. */
 enum 
   {
-    PROP_0,
-    PROP_WINDOW,
+    PROP_0
   };
 
 
@@ -112,6 +130,28 @@
 /* 
    User interface section. 
  */
+
+/* Update what parts of the dialog are shown.  */
+void
+update_show_advanced_options (SettingsDlg *dialog)
+{
+  GpaOptions *options = gpa_options_get_instance ();
+
+  g_return_if_fail (IS_SETTINGS_DLG (dialog));
+  
+  if (gpa_options_get_show_advanced_options (options))
+    {
+      gtk_widget_show_all (dialog->keyserver.frame);
+      gtk_widget_show_all (dialog->akl.frame);
+    }
+  else
+    {
+      gtk_widget_hide_all (dialog->keyserver.frame);
+      gtk_widget_hide_all (dialog->akl.frame);
+    }
+}
+
+
 static void
 advanced_mode_toggled (GtkToggleButton *button, gpointer user_data)
 {
@@ -122,8 +162,11 @@
 static void
 show_advanced_options_toggled (GtkToggleButton *button, gpointer user_data)
 {
+  SettingsDlg *dialog = user_data;
+
   gpa_options_set_show_advanced_options
     (gpa_options_get_instance (), gtk_toggle_button_get_active (button));
+  update_show_advanced_options (dialog);
 }
 
 
@@ -133,7 +176,7 @@
   GtkWidget *frame;
   GtkWidget *label;
   GtkWidget *frame_vbox;
-  GtkWidget *button, *button2;
+  GtkWidget *button;
 
   /* Build UI.  */
   frame = gtk_frame_new (NULL);
@@ -145,26 +188,17 @@
   frame_vbox = gtk_vbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER (frame), frame_vbox);
 
-  button = gtk_check_button_new_with_mnemonic (_("use _advanced mode"));
+  button = gtk_check_button_new_with_mnemonic (_("Use _advanced mode"));
   gtk_container_add (GTK_CONTAINER (frame_vbox), button);
+  dialog->ui.advanced_mode = GTK_TOGGLE_BUTTON (button);
+  g_signal_connect (G_OBJECT (button), "toggled",
+                    G_CALLBACK (advanced_mode_toggled), dialog);
 
-  button2 = gtk_check_button_new_with_mnemonic (_("show advanced _options"));
-  gtk_container_add (GTK_CONTAINER (frame_vbox), button2);
-
-
-  /* Select default value.  */
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), 
-                                !gpa_options_get_simplified_ui 
-                                (gpa_options_get_instance ()));
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button2), 
-                                !!gpa_options_get_show_advanced_options 
-                                (gpa_options_get_instance ()));
-
-  /* Connect signals.  */
+  button = gtk_check_button_new_with_mnemonic (_("Show advanced _options"));
+  gtk_container_add (GTK_CONTAINER (frame_vbox), button);
+  dialog->ui.show_advanced_options = GTK_TOGGLE_BUTTON (button);
   g_signal_connect (G_OBJECT (button), "toggled",
-                    G_CALLBACK (advanced_mode_toggled), NULL);
-  g_signal_connect (G_OBJECT (button2), "toggled",
-                    G_CALLBACK (show_advanced_options_toggled), NULL);
+                    G_CALLBACK (show_advanced_options_toggled), dialog);
 
   
   return frame;
@@ -173,7 +207,10 @@
 
 
 
-/* Default key section.  */
+/* 
+   Default key section. 
+ */
+#if 0
 static void
 key_selected_cb (GtkTreeSelection *treeselection, gpointer user_data)
 {
@@ -185,8 +222,8 @@
 			       (gpgme_key_t) selected->data);
   g_list_free (selected);
 }
+#endif /*0*/
 
-
 static GtkWidget *
 default_key_frame (SettingsDlg *dialog)
 {
@@ -218,28 +255,20 @@
   gtk_container_add (GTK_CONTAINER (frame), scroller);
 
   /* Connect signals.  */
-  g_signal_connect (G_OBJECT (gtk_tree_view_get_selection
-			      (GTK_TREE_VIEW (list))),
-		    "changed", G_CALLBACK (key_selected_cb), list);
+  /* Currently not used. */
+/*   g_signal_connect (G_OBJECT (gtk_tree_view_get_selection */
+/* 			      (GTK_TREE_VIEW (list))), */
+/* 		    "changed", G_CALLBACK (key_selected_cb), list); */
+
   return frame;
 }
 
+
 
-/* Signal handler for the "changed_show_advanced_options" signal.  */
+/*
+   Default keyserver section.
+*/
 static void
-show_advanced_options_changed_for_keyserver (GpaOptions *options,
-                                             gpointer param)
-{
-  GtkWidget *keyserver_frame = param;
-
-  if (gpa_options_get_show_advanced_options (options))
-    gtk_widget_show_all (GTK_WIDGET(keyserver_frame));
-  else
-    gtk_widget_hide_all (GTK_WIDGET(keyserver_frame));
-}
-
-
-static void
 keyserver_selected_from_list_cb (GtkComboBox *combo, gpointer user_data)
 {
   /* Consider the text entry activated.  */
@@ -285,72 +314,53 @@
   servers = keyserver_get_as_glist ();
   g_list_foreach (servers, append_to_combo, combo);
   g_list_free (servers);
-  gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo))),
-                      gpa_options_get_default_keyserver
-		      (gpa_options_get_instance ()));
+  dialog->keyserver.combo = combo;
 
-  /* Connect signals.  */
   g_signal_connect (G_OBJECT (combo),
 		    "changed",
                     G_CALLBACK (keyserver_selected_from_list_cb), NULL);
 
-  g_signal_connect (G_OBJECT (gpa_options_get_instance ()),
-		    "changed_show_advanced_options",
-                    G_CALLBACK (show_advanced_options_changed_for_keyserver), 
-                    frame);
 
   return frame;
 }
 
 
-/* Auto Key Locate section.  */
-/* Signal handler for the "changed_show_advanced_options" signal.  */
-static void
-show_advanced_options_changed_for_akl (GpaOptions *options,
-                                       gpointer param)
-{
-  GtkWidget *akl_frame = param;
+/*
+   Auto Key Locate section.  
+ */
 
-  if (gpa_options_get_show_advanced_options (options))
-    gtk_widget_show_all (GTK_WIDGET(akl_frame));
-  else
-    gtk_widget_hide_all (GTK_WIDGET(akl_frame));
-}
-
-
 static void
 akl_method_changed_cb (GtkComboBox *combo, gpointer user_data)
 {
-  GtkWidget *label = user_data;
+  SettingsDlg *dialog = user_data;
   int idx;
 
-  idx =  gtk_combo_box_get_active (combo);
+  idx = gtk_combo_box_get_active (dialog->akl.methods);
   if (idx < 0 || idx > DIM(akl_table))
     return;
 
-  /* Enable the kdns Server entry if needed.  */
-  gtk_widget_set_sensitive (label, (akl_table[idx].list
-                                    && strchr (akl_table[idx].list, 'D')) );
-  
+  /* Enable the address entry if needed.  */
+  gtk_widget_set_sensitive (dialog->akl.addr_hbox,
+                            (akl_table[idx].list
+                             && strchr (akl_table[idx].list, 'D')) );
 }
 
 static void
-akl_kdnsaddr_changed_cb (GtkEntry *entry, gpointer user_data)
+akl_addr_changed_cb (GtkEntry *entry, gpointer user_data)
 {
+  SettingsDlg *dialog = user_data;
   const char *addr;
   struct in_addr binaddr;
 
-  (void)user_data;
-
-  if (!GTK_WIDGET_IS_SENSITIVE (entry))
+  if (!GTK_WIDGET_IS_SENSITIVE (dialog->akl.addr_entry))
     return;
   
-  addr = gtk_entry_get_text (entry);
+  addr = gtk_entry_get_text (dialog->akl.addr_entry);
   g_message ("IP-address is '%s'", addr? addr : "[none]");
   if (!addr || !*addr || !inet_aton (addr, &binaddr) )
     {
       gpa_window_error ("You need to enter a valid IPv4 address.",
-                        GTK_WIDGET (entry));
+                        GTK_WIDGET (dialog));
       return;
     }
 
@@ -361,21 +371,22 @@
 
 
 static void
-parse_akl (GtkWidget *combo, GtkWidget *kdns_addr, GtkWidget *label)
+parse_akl (SettingsDlg *dialog)
 {
   akl_t akllist, akl;
-  char *akloption = gpa_load_gpgconf_string ("gpg", "auto-key-locate");
+  char *akloption;
   char list[10];
   int listidx = 0;
   int idx;
-  
+
+  akloption = gpa_load_gpgconf_string ("gpg", "auto-key-locate");
   if (!akloption)
     {
       /* Select the first entry ("Local").  */
-      gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); 
+      gtk_combo_box_set_active (dialog->akl.methods, 0); 
       /* Set kDNS server to empty.  */
-      gtk_entry_set_text (GTK_ENTRY (kdns_addr), "");
-      gtk_widget_set_sensitive (label, FALSE);
+      gtk_entry_set_text (dialog->akl.addr_entry, "");
+      gtk_widget_set_sensitive (dialog->akl.addr_hbox, FALSE);
       return;
     }
 
@@ -416,7 +427,7 @@
                && !k->opaque
                && !k->options)
             {
-              gtk_entry_set_text (GTK_ENTRY (kdns_addr), k->host);
+              gtk_entry_set_text (dialog->akl.addr_entry, k->host);
               list[listidx++] = 'D';
             }
           else
@@ -435,17 +446,17 @@
   for (idx=0; akl_table[idx].list; idx++)
     if (!strcmp (akl_table[idx].list, list))
       break;
-  /* (The last entry of tghe tale is the one used for no-match.) */
-  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), idx); 
+  /* (The last entry of the table is the one used for no-match.) */
+  gtk_combo_box_set_active (dialog->akl.methods, idx); 
   /* Enable the kdns Server entry if one is defined.  For ease of
      implementation we have already put the server address into the
-     entry field even if though there might be no match.  */
-  gtk_widget_set_sensitive (label, 
+     entry field even if there might be no match.  */
+  gtk_widget_set_sensitive (dialog->akl.addr_hbox, 
                             (akl_table[idx].list && strchr (list, 'D')));
-
 }
 
 
+
 static GtkWidget *
 auto_key_locate_frame (SettingsDlg *dialog)
 {
@@ -516,24 +527,49 @@
   gtk_entry_set_max_length (GTK_ENTRY(entry), 3+1+3+1+3+1+3);
   gtk_entry_set_width_chars (GTK_ENTRY(entry), 3+1+3+1+3+1+3);
   gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
+  
+  dialog->akl.addr_hbox = hbox;
+  dialog->akl.addr_entry = GTK_ENTRY (entry);
+  dialog->akl.methods = GTK_COMBO_BOX (combo);
 
-  parse_akl (combo, entry, hbox);
   g_signal_connect (G_OBJECT (combo),
-		    "changed", G_CALLBACK (akl_method_changed_cb), hbox);
+		    "changed", G_CALLBACK (akl_method_changed_cb), dialog);
   g_signal_connect (G_OBJECT (entry),
-		    "changed", G_CALLBACK (akl_kdnsaddr_changed_cb), NULL);
+		    "changed", G_CALLBACK (akl_addr_changed_cb), dialog);
 
+  return frame;
+}
 
-  /* Connect signals.  */
-  g_signal_connect (G_OBJECT (gpa_options_get_instance ()),
-		    "changed_show_advanced_options",
-                    G_CALLBACK (show_advanced_options_changed_for_akl), 
-                    frame);
 
-  
-  return frame;
+static void
+load_settings (SettingsDlg *dialog)
+{
+  GpaOptions *options = gpa_options_get_instance ();
+
+  g_return_if_fail (IS_SETTINGS_DLG (dialog));
+
+  /* UI section.  */
+  gtk_toggle_button_set_active 
+    (dialog->ui.advanced_mode, !gpa_options_get_simplified_ui (options));
+  gtk_toggle_button_set_active 
+    (dialog->ui.show_advanced_options, 
+     !!gpa_options_get_show_advanced_options (options));
+
+  /* Default key section.  */
+  /* FIXME: use options_get_default_key to set it.  */
+
+  /* Default keyserver section.  */
+  gtk_entry_set_text (GTK_ENTRY 
+                      (gtk_bin_get_child (GTK_BIN (dialog->keyserver.combo))),
+                      gpa_options_get_default_keyserver (options));
+
+  /* AKL section. */
+  parse_akl (dialog);
+
+
 }
 
+
 /* Save all settings, return 0 on success.  */
 static int
 save_settings (GtkDialog *dialog)
@@ -559,7 +595,6 @@
       if (save_settings (dialog))
         return;
       /* Fixme: Reload configuration.  */
-      
       return; /* Do not close.  */
 
     default:
@@ -594,7 +629,7 @@
 {
   GObject *object;
   SettingsDlg *dialog;
-  GtkWidget *frame, *keyserver_frame;
+  GtkWidget *frame;
 
   object = parent_class->constructor (type,
 				      n_construct_properties,
@@ -624,23 +659,28 @@
   gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame);
 
   /* The default keyserver section.  */
-  frame = keyserver_frame = default_keyserver_frame (dialog);
+  frame = default_keyserver_frame (dialog);
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame,
                       FALSE, FALSE, 0);
+  dialog->keyserver.frame = frame;
 
   /* The auto key locate section.  */
   frame = auto_key_locate_frame (dialog);
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), frame,
                       FALSE, FALSE, 0);
+  dialog->akl.frame = frame;
 
   /* Connect the response signal.  */
   g_signal_connect (GTK_OBJECT (dialog), "response", 
                     G_CALLBACK (dialog_response), NULL);
 
+
+  /* Load values.  */
+  load_settings (dialog);
+
   /* Show all windows and hide those we don't want. */
   gtk_widget_show_all (GTK_WIDGET(dialog));
-  if (!gpa_options_get_show_advanced_options (gpa_options_get_instance ()))
-    gtk_widget_hide_all (GTK_WIDGET(keyserver_frame));
+  update_show_advanced_options (dialog);
 
   return object;
 }
@@ -698,7 +738,8 @@
 void
 settings_dlg_new (GtkWidget *parent)
 {
-  g_return_if_fail (GTK_IS_WINDOW (parent));
+  if (parent)
+    g_return_if_fail (GTK_IS_WINDOW (parent));
 
   if (!the_settings_dialog)
     {
@@ -710,11 +751,18 @@
 
     }
 
-  if (GTK_WINDOW (parent) 
-      != gtk_window_get_transient_for (GTK_WINDOW (the_settings_dialog)))
+  if (parent 
+      && (GTK_WINDOW (parent) 
+          != gtk_window_get_transient_for (GTK_WINDOW (the_settings_dialog))))
     gtk_window_set_transient_for (GTK_WINDOW (the_settings_dialog),
                                   GTK_WINDOW (parent));
   
   gtk_window_present (GTK_WINDOW (the_settings_dialog));
 }
 
+/* Tell whether the settings dialog is open.  */
+gboolean
+settings_is_open (void)
+{
+  return !!the_settings_dialog;
+}

Modified: trunk/src/settingsdlg.h
===================================================================
--- trunk/src/settingsdlg.h	2008-05-02 13:48:40 UTC (rev 880)
+++ trunk/src/settingsdlg.h	2008-05-02 17:14:37 UTC (rev 881)
@@ -61,5 +61,8 @@
 /* Create and show the settings dialog.  */
 void settings_dlg_new (GtkWidget *parent);
 
+/* Tell whether the settings dialog is open.  */
+gboolean settings_is_open (void);
 
+
 #endif /*SETTINGSDLG_H*/



More information about the Gpa-commits mailing list