~indicator-applet-developers/indicator-datetime/trunk.0.2

« back to all changes in this revision

Viewing changes to src/datetime-prefs.c

  • Committer: Ted Gould
  • Date: 2011-03-29 19:10:12 UTC
  • mfrom: (78.5.5 indicator-datetime)
  • Revision ID: ted@gould.cx-20110329191012-fualf9htuk1yssi8
Make the locations dialog non-modal but resurface when needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
guint       save_time_id = 0;
54
54
gboolean    user_edited_time = FALSE;
55
55
gboolean    changing_time = FALSE;
 
56
GtkWidget * loc_dlg = NULL;
56
57
 
57
58
/* Turns the boolean property into a string gsettings */
58
59
static GVariant *
495
496
}
496
497
 
497
498
static void
 
499
hide_locations ()
 
500
{
 
501
  if (loc_dlg != NULL)
 
502
    gtk_widget_destroy (loc_dlg);
 
503
}
 
504
 
 
505
static void
498
506
show_locations (GtkWidget * button, GtkWidget * dlg)
499
507
{
500
 
  GtkWidget * locationsDlg = datetime_setup_locations_dialog (GTK_WINDOW (dlg), tzmap);
501
 
  gtk_widget_show_all (locationsDlg);
 
508
  if (loc_dlg == NULL) {
 
509
    loc_dlg = datetime_setup_locations_dialog (tzmap);
 
510
    gtk_window_set_transient_for (GTK_WINDOW (loc_dlg), GTK_WINDOW (dlg));
 
511
    g_signal_connect (loc_dlg, "destroy", G_CALLBACK (gtk_widget_destroyed), &loc_dlg);
 
512
    g_signal_connect (dlg, "focus-in-event", G_CALLBACK (hide_locations), NULL);
 
513
    gtk_widget_show_all (loc_dlg);
 
514
  }
 
515
  else {
 
516
    gtk_window_present_with_time (GTK_WINDOW (loc_dlg), gtk_get_current_event_time ());
 
517
  }
502
518
}
503
519
 
504
520
static gboolean