[Xfce4-commits] <xfce4-settings:master> Don't save settings dialogs when saving session (Bug #5113).

Jérôme Guelfucci noreply at xfce.org
Wed Feb 10 00:10:01 CET 2010


Updating branch refs/heads/master
         to cdb2d8d4d5086100e826fdf15c4821b4d6a67a27 (commit)
       from 2dc0f0b02dbb8be00632f9a75b7aaef8e050e4a0 (commit)

commit cdb2d8d4d5086100e826fdf15c4821b4d6a67a27
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Wed Feb 10 00:09:20 2010 +0100

    Don't save settings dialogs when saving session (Bug #5113).
    
    For this, we set a fake SM id for each dialog. This needs to be added in
    every settings dialog (Thunar, xfdesktop, xfce4-panel, xfwm4,
    xfce4-notifyd, exo-preferred-applications...).

 dialogs/accessibility-settings/main.c |   13 ++++++++++---
 dialogs/appearance-settings/main.c    |   14 ++++++++++++--
 dialogs/display-settings/main.c       |    4 ++++
 dialogs/keyboard-settings/main.c      |   15 +++++++++++++--
 dialogs/mouse-settings/main.c         |   14 ++++++++++++--
 xfce4-settings-manager/main.c         |    3 +++
 6 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/dialogs/accessibility-settings/main.c b/dialogs/accessibility-settings/main.c
index 3029dae..54ebfce 100644
--- a/dialogs/accessibility-settings/main.c
+++ b/dialogs/accessibility-settings/main.c
@@ -196,10 +196,14 @@ main (gint argc, gchar **argv)
             /* Get the dialog widget */
             dialog = gtk_builder_get_object (builder, "dialog");
 
-            /* run the dialog */
-            gtk_dialog_run (GTK_DIALOG (dialog));
+            gtk_widget_show (GTK_WIDGET (dialog));
+            g_signal_connect (dialog, "response", G_CALLBACK (gtk_main_quit), NULL);
+
+            /* To prevent the settings dialog to be saved in the session */
+            gdk_set_sm_client_id ("FAKE ID");
+
+            gtk_main ();
 
-            /* destroy the dialog */
             gtk_widget_destroy (GTK_WIDGET (dialog));
         }
         else
@@ -217,6 +221,9 @@ main (gint argc, gchar **argv)
             gtk_widget_reparent (GTK_WIDGET (plug_child), plug);
             gtk_widget_show (GTK_WIDGET (plug_child));
 
+            /* To prevent the settings dialog to be saved in the session */
+            gdk_set_sm_client_id ("FAKE ID");
+
             /* Enter main loop */
             gtk_main ();
         }
diff --git a/dialogs/appearance-settings/main.c b/dialogs/appearance-settings/main.c
index 03b3c14..5aaf2d9 100644
--- a/dialogs/appearance-settings/main.c
+++ b/dialogs/appearance-settings/main.c
@@ -830,8 +830,15 @@ main(gint argc, gchar **argv)
                 /* build the dialog */
                 dialog = gtk_builder_get_object (builder, "dialog");
 
-                /* run the dialog */
-                gtk_dialog_run (GTK_DIALOG (dialog));
+                gtk_widget_show (GTK_WIDGET (dialog));
+                g_signal_connect (dialog, "response", gtk_widget_destroy (GTK_WIDGET (dialog)));
+
+                /* To prevent the settings dialog to be saved in the session */
+                gdk_set_sm_client_id ("FAKE ID");
+
+                gtk_main ();
+
+                gtk_widget_destroy (GTK_WIDGET (dialog));
             }
             else
             {
@@ -848,6 +855,9 @@ main(gint argc, gchar **argv)
                 gtk_widget_reparent (GTK_WIDGET (plug_child), plug);
                 gtk_widget_show (GTK_WIDGET (plug_child));
 
+                /* To prevent the settings dialog to be saved in the session */
+                gdk_set_sm_client_id ("FAKE ID");
+
                 /* Enter main loop */
                 gtk_main ();
             }
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 7952527..5ff49fb 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -678,6 +678,7 @@ main (gint argc, gchar **argv)
                                                   _("The Resize and Rotate extension (RandR) is not enabled on "
                                                     "this display. Try to enable it and run the dialog again."));
         gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_QUIT, GTK_RESPONSE_CLOSE);
+
         gtk_dialog_run (GTK_DIALOG (dialog));
         gtk_widget_destroy (dialog);
 
@@ -752,6 +753,9 @@ main (gint argc, gchar **argv)
             /* show the dialog */
             gtk_widget_show (dialog);
 
+            /* To prevent the settings dialog to be saved in the session */
+            gdk_set_sm_client_id ("FAKE ID");
+
             /* enter the main loop */
             gtk_main ();
         }
diff --git a/dialogs/keyboard-settings/main.c b/dialogs/keyboard-settings/main.c
index d50f64a..73c0979 100644
--- a/dialogs/keyboard-settings/main.c
+++ b/dialogs/keyboard-settings/main.c
@@ -109,8 +109,16 @@ main (int    argc,
     {
       /* Create and run the settings dialog */
       dialog = xfce_keyboard_settings_create_dialog (settings);
-      gtk_dialog_run (GTK_DIALOG (dialog));
-      gtk_widget_destroy (dialog);
+
+      gtk_widget_show (GTK_WIDGET (dialog));
+      g_signal_connect (dialog, "response", G_CALLBACK (gtk_main_quit), NULL);
+
+      /* To prevent the settings dialog to be saved in the session */
+      gdk_set_sm_client_id ("FAKE ID");
+
+      gtk_main ();
+
+      gtk_widget_destroy (GTK_WIDGET (dialog));
     }
   else
     {
@@ -121,6 +129,9 @@ main (int    argc,
       /* Stop startup notification */
       gdk_notify_startup_complete ();
 
+      /* To prevent the settings dialog to be saved in the session */
+      gdk_set_sm_client_id ("FAKE ID");
+
       /* Enter the main loop */
       gtk_main ();
     }
diff --git a/dialogs/mouse-settings/main.c b/dialogs/mouse-settings/main.c
index 2ba4973..a758240 100644
--- a/dialogs/mouse-settings/main.c
+++ b/dialogs/mouse-settings/main.c
@@ -1315,8 +1315,15 @@ main (gint argc, gchar **argv)
                 /* unlock */
                 locked--;
 
-                /* show the dialog */
-                gtk_dialog_run (GTK_DIALOG (dialog));
+                gtk_widget_show (GTK_WIDGET (dialog));
+                g_signal_connect (dialog, "response", G_CALLBACK (gtk_main_quit), NULL);
+
+                /* To prevent the settings dialog to be saved in the session */
+                gdk_set_sm_client_id ("FAKE ID");
+
+                gtk_main ();
+
+                gtk_widget_destroy (GTK_WIDGET (dialog));
             }
             else
             {
@@ -1336,6 +1343,9 @@ main (gint argc, gchar **argv)
                 /* Unlock */
                 locked--;
 
+                /* To prevent the settings dialog to be saved in the session */
+                gdk_set_sm_client_id ("FAKE ID");
+
                 /* Enter main loop */
                 gtk_main ();
             }
diff --git a/xfce4-settings-manager/main.c b/xfce4-settings-manager/main.c
index 6144555..3853449 100644
--- a/xfce4-settings-manager/main.c
+++ b/xfce4-settings-manager/main.c
@@ -95,6 +95,9 @@ main(int argc,
                                                  opt_dialog);
     }
 
+    /* To prevent the settings dialog to be saved in the session */
+    gdk_set_sm_client_id ("FAKE ID");
+
     gtk_main();
 
     if(GTK_IS_WIDGET(dialog))



More information about the Xfce4-commits mailing list