ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #03474
[Merge] lp:~mterry/indicator-datetime/non-modal-locations into lp:indicator-datetime
Michael Terry has proposed merging lp:~mterry/indicator-datetime/non-modal-locations into lp:indicator-datetime with lp:~mterry/indicator-datetime/crash-fix-and-more as a prerequisite.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
Related bugs:
Bug #740924 in Indicator Date and Time: ""Locations" window behaves like a modal dialog"
https://bugs.launchpad.net/indicator-datetime/+bug/740924
For more details, see:
https://code.launchpad.net/~mterry/indicator-datetime/non-modal-locations/+merge/55357
--
https://code.launchpad.net/~mterry/indicator-datetime/non-modal-locations/+merge/55357
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'data/datetime-dialog.ui'
--- data/datetime-dialog.ui 2011-03-29 15:19:47 +0000
+++ data/datetime-dialog.ui 2011-03-29 15:19:47 +0000
@@ -10,7 +10,6 @@
<object class="GtkWindow" id="locationsDialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Locations</property>
- <property name="modal">True</property>
<property name="default_width">300</property>
<property name="default_height">200</property>
<property name="destroy_with_parent">True</property>
=== modified file 'src/datetime-prefs-locations.c'
--- src/datetime-prefs-locations.c 2011-03-29 15:19:47 +0000
+++ src/datetime-prefs-locations.c 2011-03-29 15:19:47 +0000
@@ -309,7 +309,7 @@
}
GtkWidget *
-datetime_setup_locations_dialog (GtkWindow * parent, CcTimezoneMap * map)
+datetime_setup_locations_dialog (CcTimezoneMap * map)
{
GError * error = NULL;
GtkBuilder * builder = gtk_builder_new ();
@@ -375,8 +375,6 @@
g_object_set_data (G_OBJECT (dlg), "time-id", GINT_TO_POINTER(time_id));
update_times (dlg);
- gtk_window_set_transient_for (GTK_WINDOW (dlg), parent);
-
#undef WIG
g_object_unref (conf);
=== modified file 'src/datetime-prefs-locations.h'
--- src/datetime-prefs-locations.h 2011-02-23 18:28:53 +0000
+++ src/datetime-prefs-locations.h 2011-03-29 15:19:47 +0000
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-GtkWidget * datetime_setup_locations_dialog (GtkWindow * parent, CcTimezoneMap * map);
+GtkWidget * datetime_setup_locations_dialog (CcTimezoneMap * map);
G_END_DECLS
=== modified file 'src/datetime-prefs.c'
--- src/datetime-prefs.c 2011-03-11 04:02:32 +0000
+++ src/datetime-prefs.c 2011-03-29 15:19:47 +0000
@@ -53,6 +53,7 @@
guint save_time_id = 0;
gboolean user_edited_time = FALSE;
gboolean changing_time = FALSE;
+GtkWidget * loc_dlg = NULL;
/* Turns the boolean property into a string gsettings */
static GVariant *
@@ -495,10 +496,25 @@
}
static void
+hide_locations ()
+{
+ if (loc_dlg != NULL)
+ gtk_widget_destroy (loc_dlg);
+}
+
+static void
show_locations (GtkWidget * button, GtkWidget * dlg)
{
- GtkWidget * locationsDlg = datetime_setup_locations_dialog (GTK_WINDOW (dlg), tzmap);
- gtk_widget_show_all (locationsDlg);
+ if (loc_dlg == NULL) {
+ loc_dlg = datetime_setup_locations_dialog (tzmap);
+ gtk_window_set_transient_for (GTK_WINDOW (loc_dlg), GTK_WINDOW (dlg));
+ g_signal_connect (loc_dlg, "destroy", G_CALLBACK (gtk_widget_destroyed), &loc_dlg);
+ g_signal_connect (dlg, "focus-in-event", G_CALLBACK (hide_locations), NULL);
+ gtk_widget_show_all (loc_dlg);
+ }
+ else {
+ gtk_window_present_with_time (GTK_WINDOW (loc_dlg), gtk_get_current_event_time ());
+ }
}
static gboolean
Follow ups