diff options
author | Michael Terry <mike@mterry.name> | 2011-03-03 09:34:57 -0500 |
---|---|---|
committer | Michael Terry <mike@mterry.name> | 2011-03-03 09:34:57 -0500 |
commit | 8dbd819cd5143cb6016b775d0e229819cf324604 (patch) | |
tree | 0473e77b07c2a65ea73614466d6aac3f505f0966 /src/datetime-prefs.c | |
parent | b79665734363a3644d3eb7b13a110908ac05d3a1 (diff) | |
download | ayatana-indicator-datetime-8dbd819cd5143cb6016b775d0e229819cf324604.tar.gz ayatana-indicator-datetime-8dbd819cd5143cb6016b775d0e229819cf324604.tar.bz2 ayatana-indicator-datetime-8dbd819cd5143cb6016b775d0e229819cf324604.zip |
fix some visual issues mpt found; drop libmap/Makefile.in from bzr
Diffstat (limited to 'src/datetime-prefs.c')
-rw-r--r-- | src/datetime-prefs.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c index e69d58b..2435eff 100644 --- a/src/datetime-prefs.c +++ b/src/datetime-prefs.c @@ -30,6 +30,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <locale.h> #include <langinfo.h> #include <glib/gi18n-lib.h> +#include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> #include <unique/unique.h> #include <polkitgtk/polkitgtk.h> @@ -426,6 +427,32 @@ timezone_selected (GtkEntryCompletion * widget, GtkTreeModel * model, return FALSE; // Do normal action too } +static gboolean +key_pressed (GtkWidget * widget, GdkEventKey * event, gpointer user_data) +{ + switch (event->keyval) { + case GDK_KEY_Escape: + gtk_widget_destroy (widget); + return TRUE; + } + return FALSE; +} + +static GtkWidget * +get_child_of_type (GtkContainer * parent, GType type) +{ + GList * children, * iter; + + children = gtk_container_get_children (parent); + for (iter = children; iter; iter = iter->next) { + if (G_TYPE_CHECK_INSTANCE_TYPE (iter->data, type)) { + return GTK_WIDGET (iter->data); + } + } + + return NULL; +} + static GtkWidget * create_dialog (void) { @@ -451,6 +478,11 @@ create_dialog (void) polkit_lock_button_set_unlock_text (POLKIT_LOCK_BUTTON (polkit_button), _("Unlock to change these settings")); polkit_lock_button_set_lock_text (POLKIT_LOCK_BUTTON (polkit_button), _("Lock to prevent further changes")); gtk_box_pack_start (GTK_BOX (WIG ("timeDateBox")), polkit_button, FALSE, TRUE, 0); + /* Make sure border around button is visible */ + GtkWidget * polkit_button_button = get_child_of_type (GTK_CONTAINER (polkit_button), GTK_TYPE_BUTTON); + if (polkit_button_button != NULL) { + gtk_button_set_relief (GTK_BUTTON (polkit_button_button), GTK_RELIEF_NORMAL); + } /* Add map */ tzmap = cc_timezone_map_new (); @@ -513,6 +545,7 @@ create_dialog (void) tz_entry = WIG ("timezoneEntry"); g_signal_connect (WIG ("locationsButton"), "clicked", G_CALLBACK (show_locations), dlg); + g_signal_connect (dlg, "key-press-event", G_CALLBACK (key_pressed), NULL); /* Grab proxy for settings daemon */ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, @@ -565,7 +598,7 @@ main (int argc, char ** argv) unique_app_watch_window (app, GTK_WINDOW (dlg)); gtk_widget_show_all (dlg); - g_signal_connect (dlg, "response", G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect (dlg, "destroy", G_CALLBACK(gtk_main_quit), NULL); gtk_main (); } |