Construct entry in location action, obsoleting location entry class
This commit is contained in:
parent
d55e771b3a
commit
af43d5a761
6 changed files with 28 additions and 104 deletions
|
@ -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));
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2008 Dale Whittaker <dayul@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);
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2008 Dale Whittaker <dayul@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__ */
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue