aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-29 14:10:12 -0500
committerTed Gould <ted@gould.cx>2011-03-29 14:10:12 -0500
commit0a8409579dd931abc162ec17fb40b3df385ddfab (patch)
tree015dfb19777a87bd9923b7d778fc5744bfaddba5
parent5d401d9c978453c29c6d74694fe68e4155534283 (diff)
parent18ea5194b357dbd14dd724eb32013af8031a50be (diff)
downloadayatana-indicator-datetime-0a8409579dd931abc162ec17fb40b3df385ddfab.tar.gz
ayatana-indicator-datetime-0a8409579dd931abc162ec17fb40b3df385ddfab.tar.bz2
ayatana-indicator-datetime-0a8409579dd931abc162ec17fb40b3df385ddfab.zip
Make the locations dialog non-modal but resurface when needed.
-rw-r--r--data/datetime-dialog.ui1
-rw-r--r--src/datetime-prefs-locations.c4
-rw-r--r--src/datetime-prefs-locations.h2
-rw-r--r--src/datetime-prefs.c20
4 files changed, 20 insertions, 7 deletions
diff --git a/data/datetime-dialog.ui b/data/datetime-dialog.ui
index ead11d1..f150765 100644
--- a/data/datetime-dialog.ui
+++ b/data/datetime-dialog.ui
@@ -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>
diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c
index d13f95a..5dd13e8 100644
--- a/src/datetime-prefs-locations.c
+++ b/src/datetime-prefs-locations.c
@@ -309,7 +309,7 @@ selection_changed (GtkTreeSelection * selection, GtkWidget * remove_button)
}
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 @@ datetime_setup_locations_dialog (GtkWindow * parent, CcTimezoneMap * map)
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);
diff --git a/src/datetime-prefs-locations.h b/src/datetime-prefs-locations.h
index 1760567..e312894 100644
--- a/src/datetime-prefs-locations.h
+++ b/src/datetime-prefs-locations.h
@@ -28,7 +28,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
G_BEGIN_DECLS
-GtkWidget * datetime_setup_locations_dialog (GtkWindow * parent, CcTimezoneMap * map);
+GtkWidget * datetime_setup_locations_dialog (CcTimezoneMap * map);
G_END_DECLS
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index fbc88f2..5a6fd91 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -53,6 +53,7 @@ GtkWidget * date_spin = NULL;
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 @@ setup_time_spinners (GtkWidget * time, GtkWidget * date)
}
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