]> spindle.queued.net Git - midori/commitdiff
Move up/ down key handling from the entry into MidoriLocationAction
authorChristian Dywan <christian@twotoasts.de>
Fri, 1 Jan 2010 17:23:15 +0000 (18:23 +0100)
committerChristian Dywan <christian@twotoasts.de>
Fri, 1 Jan 2010 17:23:15 +0000 (18:23 +0100)
midori/midori-locationaction.c
midori/midori-locationentry.c
midori/midori-locationentry.h
tests/properties.c

index 4939b567a991d85a8ff8e03a6ddf26da60678743..73fe6af1bb49fd562eec3dd0fb130a5b52aac8d6 100644 (file)
@@ -542,7 +542,7 @@ midori_location_action_create_tool_item (GtkAction* action)
     alignment = gtk_alignment_new (0.0f, 0.5f, 1.0f, 0.1f);
     gtk_widget_show (alignment);
     gtk_container_add (GTK_CONTAINER (toolitem), alignment);
-    location_entry = midori_location_entry_new ();
+    location_entry = g_object_new (MIDORI_TYPE_LOCATION_ENTRY, NULL);
     gtk_widget_show (location_entry);
     gtk_container_add (GTK_CONTAINER (alignment), location_entry);
 
@@ -581,6 +581,19 @@ midori_location_action_key_press_event_cb (GtkEntry*    entry,
         g_signal_emit (action, signals[RESET_URI], 0);
         return TRUE;
     }
+    case GDK_Down:
+    case GDK_Up:
+    {
+        GtkWidget* parent = gtk_widget_get_parent (GTK_WIDGET (entry));
+        if (!katze_object_get_boolean (parent, "popup-shown"))
+            gtk_combo_box_popup (GTK_COMBO_BOX (parent));
+        return TRUE;
+    }
+    case GDK_Page_Up:
+    case GDK_Page_Down:
+    {
+        return TRUE;
+    }
     }
     return FALSE;
 }
index cb42c67c90c440c0e86d75ff933223234560195b..5dc5a42972cc4d0b81dc3148bf741612e4b5abcc 100644 (file)
@@ -30,11 +30,6 @@ struct _MidoriLocationEntryClass
 G_DEFINE_TYPE (MidoriLocationEntry,
     midori_location_entry, GTK_TYPE_COMBO_BOX_ENTRY)
 
-static gboolean
-entry_key_press_event (GtkWidget*           widget,
-                       GdkEventKey*         event,
-                       MidoriLocationEntry* location_entry);
-
 static void
 midori_location_entry_class_init (MidoriLocationEntryClass* class)
 {
@@ -393,8 +388,6 @@ midori_location_entry_init (MidoriLocationEntry* location_entry)
     gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (entry),
          GTK_ICON_ENTRY_SECONDARY, TRUE);
     #endif
-    g_signal_connect_after (entry, "key-press-event",
-        G_CALLBACK (entry_key_press_event), location_entry);
     #if !GTK_CHECK_VERSION (2, 16, 0)
     g_signal_connect_after (entry, "expose-event",
         G_CALLBACK (entry_expose_event), location_entry);
@@ -402,40 +395,3 @@ midori_location_entry_init (MidoriLocationEntry* location_entry)
     gtk_widget_show (entry);
     gtk_container_add (GTK_CONTAINER (location_entry), entry);
 }
-
-static gboolean
-entry_key_press_event (GtkWidget*           widget,
-                       GdkEventKey*         event,
-                       MidoriLocationEntry* location_entry)
-{
-    switch (event->keyval)
-    {
-        case GDK_Down:
-        case GDK_Up:
-        {
-            if (!katze_object_get_boolean (location_entry, "popup-shown"))
-                gtk_combo_box_popup (GTK_COMBO_BOX (location_entry));
-            return TRUE;
-        }
-        case GDK_Page_Up:
-        case GDK_Page_Down:
-        {
-            return TRUE;
-        }
-    }
-
-    return FALSE;
-}
-
-/**
- * midori_location_entry_new:
- *
- * Creates a new #MidoriLocationEntry.
- *
- * Return value: a new #MidoriLocationEntry
- **/
-GtkWidget*
-midori_location_entry_new (void)
-{
-    return g_object_new (MIDORI_TYPE_LOCATION_ENTRY, NULL);
-}
index 7a2317f4fa1a9357cb0817dfa8abf55d96eb9df4..8841f54b36a44a1e0e67ace79a077315c91f7e8c 100644 (file)
@@ -29,9 +29,6 @@ typedef struct _MidoriLocationEntryClass    MidoriLocationEntryClass;
 GType
 midori_location_entry_get_type             (void);
 
-GtkWidget*
-midori_location_entry_new                  (void);
-
 void
 midori_location_entry_set_progress         (MidoriLocationEntry* location_entry,
                                             gdouble              progress);
index 239717caaad7a496b6f065b1049e80c289bd5e45..93bf222885ed2ba60b2e84c0784d549d74b16240 100644 (file)
@@ -205,8 +205,6 @@ main (int    argc,
         (gconstpointer)MIDORI_TYPE_EXTENSION, properties_type_test);
     g_test_add_data_func ("/properties/location-action",
         (gconstpointer)MIDORI_TYPE_LOCATION_ACTION, properties_type_test);
-    g_test_add_data_func ("/properties/location-entry",
-        (gconstpointer)MIDORI_TYPE_LOCATION_ENTRY, properties_type_test);
     g_test_add_data_func ("/properties/panel",
         (gconstpointer)MIDORI_TYPE_PANEL, properties_type_test);
     g_test_add_data_func ("/properties/preferences",