From af43d5a761ffc5ff770971619e30f929fd389e1f Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 2 Jan 2010 00:28:44 +0100 Subject: [PATCH] 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(-) delete mode 100644 midori/midori-locationentry.c delete mode 100644 midori/midori-locationentry.h diff --git a/midori/midori-browser.c b/midori/midori-browser.c index fbd0d585..438c8819 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 ee8afad8..053656eb 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 b3f1781f..33c3a39e 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 G_BEGIN_DECLS diff --git a/midori/midori-locationentry.c b/midori/midori-locationentry.c deleted file mode 100644 index 80d3637c..00000000 --- a/midori/midori-locationentry.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2008 Dale Whittaker - - 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 - -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 0c4041e4..00000000 --- a/midori/midori-locationentry.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2008 Dale Whittaker - - 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 - -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 0886b7cd..44c47821 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"