[Xfce4-commits] <midori:master> Construct entry in location action, obsoleting location entry class

Christian Dywan noreply at xfce.org
Sat Jan 2 03:50:03 CET 2010


Updating branch refs/heads/master
         to af43d5a761ffc5ff770971619e30f929fd389e1f (commit)
       from d55e771b3a62b60e72ca87d67f0b62674c906cf5 (commit)

commit af43d5a761ffc5ff770971619e30f929fd389e1f
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Jan 2 00:28:44 2010 +0100

    Construct entry in location action, obsoleting location entry class

 midori/midori-browser.c        |    2 +-
 midori/midori-locationaction.c |   28 ++++++++++++++++-
 midori/midori-locationaction.h |    2 -
 midori/midori-locationentry.c  |   65 ----------------------------------------
 midori/midori-locationentry.h  |   34 ---------------------
 midori/midori.h                |    1 -
 6 files changed, 28 insertions(+), 104 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index fbd0d58..438c881 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -391,7 +391,7 @@ _midori_browser_set_statusbar_text (MidoriBrowser* browser,
 {
     GtkWidget* widget = gtk_window_get_focus (GTK_WINDOW (browser));
     gboolean is_location = widget ?
-        MIDORI_IS_LOCATION_ENTRY (gtk_widget_get_parent (widget)) : FALSE;
+        GTK_IS_COMBO_BOX (gtk_widget_get_parent (widget)) : FALSE;
 
     katze_assign (browser->statusbar_text, sokoke_format_uri_for_display (text));
 
diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c
index ee8afad..053656e 100644
--- a/midori/midori-locationaction.c
+++ b/midori/midori-locationaction.c
@@ -240,6 +240,12 @@ midori_location_action_class_init (MidoriLocationActionClass* class)
                                      "The list of history items",
                                      KATZE_TYPE_ARRAY,
                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+    /* We want location entries to have appears-as-list applied */
+    gtk_rc_parse_string ("style \"midori-location-entry-style\" {\n"
+                         "  GtkComboBox::appears-as-list = 1\n }\n"
+                         "widget \"*MidoriLocationEntry\" "
+                         "style \"midori-location-entry-style\"\n");
 }
 
 /* Allow this to be used in tests, it's otherwise private */
@@ -535,6 +541,10 @@ midori_location_action_create_tool_item (GtkAction* action)
     GtkWidget* toolitem;
     GtkWidget* alignment;
     GtkWidget* location_entry;
+    GtkWidget* entry;
+    #if HAVE_HILDON
+    HildonGtkInputMode mode;
+    #endif
 
     toolitem = GTK_WIDGET (gtk_tool_item_new ());
     gtk_tool_item_set_expand (GTK_TOOL_ITEM (toolitem), TRUE);
@@ -542,10 +552,26 @@ 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 = g_object_new (MIDORI_TYPE_LOCATION_ENTRY, NULL);
+    location_entry = gtk_combo_box_entry_new ();
+    gtk_widget_set_name (location_entry, "MidoriLocationEntry");
     gtk_widget_show (location_entry);
     gtk_container_add (GTK_CONTAINER (alignment), location_entry);
 
+    #if HAVE_HILDON
+    entry = gtk_entry_new ();
+    mode = hildon_gtk_entry_get_input_mode (GTK_ENTRY (entry));
+    mode &= ~HILDON_GTK_INPUT_MODE_AUTOCAP;
+    hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry), mode);
+    #else
+    entry = gtk_icon_entry_new ();
+    gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
+         GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_FILE);
+    gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (entry),
+         GTK_ICON_ENTRY_SECONDARY, TRUE);
+    #endif
+    gtk_widget_show (entry);
+    gtk_container_add (GTK_CONTAINER (location_entry), entry);
+
     return toolitem;
 }
 
diff --git a/midori/midori-locationaction.h b/midori/midori-locationaction.h
index b3f1781..33c3a39 100644
--- a/midori/midori-locationaction.h
+++ b/midori/midori-locationaction.h
@@ -12,8 +12,6 @@
 #ifndef __MIDORI_LOCATION_ACTION_H__
 #define __MIDORI_LOCATION_ACTION_H__
 
-#include "midori-locationentry.h"
-
 #include <katze/katze.h>
 
 G_BEGIN_DECLS
diff --git a/midori/midori-locationentry.c b/midori/midori-locationentry.c
deleted file mode 100644
index 80d3637..0000000
--- a/midori/midori-locationentry.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- Copyright (C) 2008 Dale Whittaker <dayul at users.sf.net>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#include "midori-locationentry.h"
-
-#include "gtkiconentry.h"
-#include "sokoke.h"
-#include <gdk/gdkkeysyms.h>
-
-struct _MidoriLocationEntry
-{
-    GtkComboBoxEntry parent_instance;
-};
-
-struct _MidoriLocationEntryClass
-{
-    GtkComboBoxEntryClass parent_class;
-};
-
-G_DEFINE_TYPE (MidoriLocationEntry,
-    midori_location_entry, GTK_TYPE_COMBO_BOX_ENTRY)
-
-static void
-midori_location_entry_class_init (MidoriLocationEntryClass* class)
-{
-
-}
-
-static void
-midori_location_entry_init (MidoriLocationEntry* location_entry)
-{
-    GtkWidget* entry;
-    #if HAVE_HILDON
-    HildonGtkInputMode mode;
-    #endif
-
-    /* We want the widget to have appears-as-list applied */
-    gtk_rc_parse_string ("style \"midori-location-entry-style\" {\n"
-                         "  GtkComboBox::appears-as-list = 1\n }\n"
-                         "widget_class \"*MidoriLocationEntry\" "
-                         "style \"midori-location-entry-style\"\n");
-
-    #if HAVE_HILDON
-    entry = gtk_entry_new ();
-    mode = hildon_gtk_entry_get_input_mode (GTK_ENTRY (entry));
-    mode &= ~HILDON_GTK_INPUT_MODE_AUTOCAP;
-    hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry), mode);
-    #else
-    entry = gtk_icon_entry_new ();
-    gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry),
-         GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_FILE);
-    gtk_icon_entry_set_icon_highlight (GTK_ICON_ENTRY (entry),
-         GTK_ICON_ENTRY_SECONDARY, TRUE);
-    #endif
-    gtk_widget_show (entry);
-    gtk_container_add (GTK_CONTAINER (location_entry), entry);
-}
diff --git a/midori/midori-locationentry.h b/midori/midori-locationentry.h
deleted file mode 100644
index 0c4041e..0000000
--- a/midori/midori-locationentry.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Copyright (C) 2008 Dale Whittaker <dayul at users.sf.net>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- See the file COPYING for the full license text.
-*/
-
-#ifndef __MIDORI_LOCATION_ENTRY_H__
-#define __MIDORI_LOCATION_ENTRY_H__
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define MIDORI_TYPE_LOCATION_ENTRY            (midori_location_entry_get_type ())
-#define MIDORI_LOCATION_ENTRY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIDORI_TYPE_LOCATION_ENTRY, MidoriLocationEntry))
-#define MIDORI_LOCATION_ENTRY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  MIDORI_TYPE_LOCATION_ENTRY, MidoriLocationEntryClass))
-#define MIDORI_IS_LOCATION_ENTRY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIDORI_TYPE_LOCATION_ENTRY))
-#define MIDORI_IS_LOCATION_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  MIDORI_TYPE_LOCATION_ENTRY))
-#define MIDORI_LOCATION_ENTRY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  MIDORI_TYPE_LOCATION_ENTRY, MidoriLocationEntryClass))
-
-typedef struct _MidoriLocationEntry         MidoriLocationEntry;
-typedef struct _MidoriLocationEntryClass    MidoriLocationEntryClass;
-
-GType
-midori_location_entry_get_type             (void);
-
-G_END_DECLS
-
-#endif /* __MIDORI_LOCATION_ENTRY_H__ */
diff --git a/midori/midori.h b/midori/midori.h
index 0886b7c..44c4782 100644
--- a/midori/midori.h
+++ b/midori/midori.h
@@ -17,7 +17,6 @@
 #include "midori-browser.h"
 #include "midori-extension.h"
 #include "midori-locationaction.h"
-#include "midori-locationentry.h"
 #include "midori-panel.h"
 #include "midori-preferences.h"
 #include "midori-searchaction.h"



More information about the Xfce4-commits mailing list