diff options
author | Michael Terry <mike@mterry.name> | 2011-02-22 15:17:48 -0600 |
---|---|---|
committer | Michael Terry <mike@mterry.name> | 2011-02-22 15:17:48 -0600 |
commit | deafbc1da6b3c29e04455e46414342bcb9841c2a (patch) | |
tree | 6bb04fbe40f5a5ffebb31a95b328c76d363e6379 /src/datetime-prefs-locations.c | |
parent | 07c5056f4604b4294f42492e27ea3fcf85019dc3 (diff) | |
download | ayatana-indicator-datetime-deafbc1da6b3c29e04455e46414342bcb9841c2a.tar.gz ayatana-indicator-datetime-deafbc1da6b3c29e04455e46414342bcb9841c2a.tar.bz2 ayatana-indicator-datetime-deafbc1da6b3c29e04455e46414342bcb9841c2a.zip |
beginnings of completion support
Diffstat (limited to 'src/datetime-prefs-locations.c')
-rw-r--r-- | src/datetime-prefs-locations.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c index 7df41e7..b13d082 100644 --- a/src/datetime-prefs-locations.c +++ b/src/datetime-prefs-locations.c @@ -29,6 +29,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "datetime-prefs-locations.h" #include "settings-shared.h" +#include "timezone-completion.h" #define DATETIME_DIALOG_UI_FILE PKGDATADIR "/datetime-dialog.ui" @@ -86,6 +87,16 @@ handle_edit (GtkCellRendererText * renderer, gchar * path, gchar * new_text, } static void +handle_edit_started (GtkCellRendererText * renderer, GtkCellEditable * editable, + gchar * path, TimezoneCompletion * completion) +{ + if (GTK_IS_ENTRY (editable)) { + GtkEntry *entry = GTK_ENTRY (editable); + gtk_entry_set_completion (entry, GTK_ENTRY_COMPLETION (timezone_completion_new ())); + } +} + +static void fill_from_settings (GObject * store, GSettings * conf) { gchar ** locations = g_settings_get_strv (conf, SETTINGS_LOCATIONS_S); @@ -161,8 +172,10 @@ datetime_setup_locations_dialog (GtkWindow * parent) GObject * store = gtk_builder_get_object (builder, "locationsStore"); /* Configure tree */ + TimezoneCompletion * completion = timezone_completion_new (); GtkCellRenderer * cell = gtk_cell_renderer_text_new (); g_object_set (cell, "editable", TRUE, NULL); + g_signal_connect (cell, "editing-started", G_CALLBACK (handle_edit_started), completion); g_signal_connect (cell, "edited", G_CALLBACK (handle_edit), store); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, _("Location"), cell, @@ -181,7 +194,9 @@ datetime_setup_locations_dialog (GtkWindow * parent) g_signal_connect (WIG ("removeButton"), "clicked", G_CALLBACK (handle_remove), tree); fill_from_settings (store, conf); + g_object_set_data_full (G_OBJECT (dlg), "conf", g_object_ref (conf), g_object_unref); + g_object_set_data_full (G_OBJECT (dlg), "completion", completion, g_object_unref); g_signal_connect (dlg, "destroy", G_CALLBACK (save_to_settings), store); gtk_window_set_transient_for (GTK_WINDOW (dlg), parent); |