aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2004-06-22 03:25:41 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2004-06-22 03:25:41 +0800
commitbcc276fa99bbded1b5b42503dfb2feca30c48e24 (patch)
tree07f68b570bba65521d8870eeb9fd3832b9d3a497
parent54d27764848058ad591478a56a67ec49bee20efe (diff)
downloadgsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar.gz
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar.bz2
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar.lz
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar.xz
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar.zst
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.zip
Factor out the helper to select a treeview row by column and use it also
2004-06-21 Marco Pesenti Gritti <marco@gnome.org> * lib/ephy-gui.c: (ephy_gui_help), (ephy_gui_select_row_by_key): * lib/widgets/ephy-node-view.c: (ephy_node_view_key_press_cb): * src/bookmarks/ephy-topics-selector.c: (topic_key_pressed): Factor out the helper to select a treeview row by column and use it also in the topic selector. * lib/ephy-gui.h: * src/bookmarks/ephy-bookmarks-editor.c: * src/bookmarks/ephy-new-bookmark.c: * src/ephy-history-window.c: * src/pdm-dialog.c: * src/ppview-toolbar.c: * src/prefs-dialog.c: * src/window-commands.c: * embed/downloader-view.c: Remove braindead gtk.h inclusion and deal with fallout headers.
-rw-r--r--ChangeLog22
-rw-r--r--embed/downloader-view.c5
-rw-r--r--lib/ephy-gui.c55
-rw-r--r--lib/ephy-gui.h9
-rw-r--r--lib/widgets/ephy-node-view.c62
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c10
-rw-r--r--src/bookmarks/ephy-new-bookmark.c1
-rw-r--r--src/bookmarks/ephy-topics-selector.c8
-rw-r--r--src/ephy-history-window.c8
-rwxr-xr-xsrc/pdm-dialog.c5
-rwxr-xr-xsrc/ppview-toolbar.c2
-rw-r--r--src/prefs-dialog.c3
-rw-r--r--src/window-commands.c2
13 files changed, 133 insertions, 59 deletions
diff --git a/ChangeLog b/ChangeLog
index bba1dd45b..47b50e1ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
2004-06-21 Marco Pesenti Gritti <marco@gnome.org>
+ * lib/ephy-gui.c: (ephy_gui_help), (ephy_gui_select_row_by_key):
+ * lib/widgets/ephy-node-view.c: (ephy_node_view_key_press_cb):
+ * src/bookmarks/ephy-topics-selector.c: (topic_key_pressed):
+
+ Factor out the helper to select a treeview row by column and
+ use it also in the topic selector.
+
+ * lib/ephy-gui.h:
+ * src/bookmarks/ephy-bookmarks-editor.c:
+ * src/bookmarks/ephy-new-bookmark.c:
+ * src/ephy-history-window.c:
+ * src/pdm-dialog.c:
+ * src/ppview-toolbar.c:
+ * src/prefs-dialog.c:
+ * src/window-commands.c:
+ * embed/downloader-view.c:
+
+ Remove braindead gtk.h inclusion and deal with
+ fallout headers.
+
+2004-06-21 Marco Pesenti Gritti <marco@gnome.org>
+
* src/bookmarks/ephy-new-bookmark.c: (response_cb),
(ephy_new_bookmark_construct):
* src/bookmarks/ephy-topics-selector.c: (renderer_edited_cb),
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 38bbc910a..48ffd1921 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -24,8 +24,6 @@
#endif
#include "downloader-view.h"
-#include "ephy-gui.h"
-#include "ephy-ellipsizing-label.h"
#include "ephy-file-helpers.h"
#include "ephy-embed-shell.h"
#include "ephy-cell-renderer-progress.h"
@@ -36,6 +34,9 @@
#include <eggtraymanager.h>
#include <gtk/gtktreeview.h>
#include <gtk/gtkliststore.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtktreeselection.h>
#include <gtk/gtktreeviewcolumn.h>
#include <glib/gi18n.h>
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
index 7fa42634b..09ef4ef4a 100644
--- a/lib/ephy-gui.c
+++ b/lib/ephy-gui.c
@@ -31,6 +31,10 @@
#include <libgnome/gnome-help.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtkmessagedialog.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtkimage.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkstock.h>
/* Styles for tab labels */
GtkStyle *loading_text_style = NULL;
@@ -159,3 +163,54 @@ ephy_gui_help (GtkWindow *parent,
g_error_free (err);
}
}
+
+gboolean
+ephy_gui_select_row_by_key (GtkTreeView *treeview, gint column, guint32 unicode)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter, last_iter;
+ GtkTreePath *path;
+ GValue value = {0, };
+ char *string;
+ char *event_string;
+ gboolean found = FALSE;
+ char outbuf[6];
+ int length;
+
+ model = gtk_tree_view_get_model (treeview);
+
+ length = g_unichar_to_utf8 (unicode, outbuf);
+ event_string = g_utf8_casefold (outbuf, length);
+
+ if (!gtk_tree_model_get_iter_first (model, &iter))
+ {
+ g_free (event_string);
+ return FALSE;
+ }
+
+ do
+ {
+ last_iter = iter;
+ gtk_tree_model_get_value (model, &iter, column, &value);
+
+ string = g_utf8_casefold (g_value_get_string (&value), -1);
+ g_utf8_strncpy (string, string, 1);
+ found = (g_utf8_collate (string, event_string) == 0);
+
+ g_free (string);
+ g_value_unset (&value);
+ }
+ while (!found && gtk_tree_model_iter_next (model, &iter));
+
+ if (!found)
+ {
+ iter = last_iter;
+ }
+
+ path = gtk_tree_model_get_path (model, &iter);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (treeview), path, NULL, FALSE);
+ gtk_tree_path_free (path);
+ g_free (event_string);
+
+ return TRUE;
+}
diff --git a/lib/ephy-gui.h b/lib/ephy-gui.h
index 73ab060d2..685b70613 100644
--- a/lib/ephy-gui.h
+++ b/lib/ephy-gui.h
@@ -21,7 +21,10 @@
#ifndef EPHY_GUI_H
#define EPHY_GUI_H
-#include <gtk/gtk.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtktreeview.h>
+#include <gtk/gtktreeviewcolumn.h>
+#include <gtk/gtkwindow.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdkkeysyms.h>
@@ -33,6 +36,10 @@ void ephy_gui_menu_position_under_widget (GtkMenu *menu,
gboolean *push_in,
gpointer user_data);
+gboolean ephy_gui_select_row_by_key (GtkTreeView *treeview,
+ gint column,
+ guint32 unicode);
+
gboolean ephy_gui_confirm_overwrite_file (GtkWidget *parent,
const char *filename);
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 3cf8294a2..3b037d3db 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -35,6 +35,7 @@
#include "ephy-tree-model-sort.h"
#include "eggtreemultidnd.h"
#include "ephy-dnd.h"
+#include "ephy-gui.h"
#include "ephy-marshal.h"
#include "string.h"
@@ -661,62 +662,15 @@ ephy_node_view_row_activated_cb (GtkTreeView *treeview,
g_signal_emit (G_OBJECT (view), ephy_node_view_signals[NODE_ACTIVATED], 0, node);
}
-
-static gboolean
-ephy_node_view_select_node_by_key (EphyNodeView *view, GdkEventKey *event)
-{
- GtkTreeIter iter, last_iter;
- GtkTreePath *path;
- GValue value = {0, };
- gchar *string;
- gchar *event_string;
- gboolean found = FALSE;
- gchar outbuf[6];
- gint length;
-
- length = g_unichar_to_utf8 (gdk_keyval_to_unicode (event->keyval), outbuf);
- event_string = g_utf8_casefold (outbuf, length);
-
- if (!gtk_tree_model_get_iter_first (view->priv->sortmodel, &iter))
- {
- g_free (event_string);
- return FALSE;
- }
-
- do
- {
- last_iter = iter;
- gtk_tree_model_get_value (view->priv->sortmodel, &iter,
- view->priv->searchable_data_column,
- &value);
-
- string = g_utf8_casefold (g_value_get_string (&value), -1);
- g_utf8_strncpy (string, string, 1);
- found = (g_utf8_collate (string, event_string) == 0);
-
- g_free (string);
- g_value_unset (&value);
- }
- while (!found && gtk_tree_model_iter_next (view->priv->sortmodel, &iter));
-
- if (!found)
- {
- iter = last_iter;
- }
-
- path = gtk_tree_model_get_path (view->priv->sortmodel, &iter);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, NULL, FALSE);
- gtk_tree_path_free (path);
- g_free (event_string);
-
- return TRUE;
-}
-
static gboolean
ephy_node_view_key_press_cb (GtkTreeView *treeview,
GdkEventKey *event,
EphyNodeView *view)
{
+ guint32 unicode;
+
+ unicode = gdk_keyval_to_unicode (event->keyval);
+
if ((event->state & GDK_SHIFT_MASK) &&
(event->keyval == GDK_F10))
{
@@ -724,10 +678,10 @@ ephy_node_view_key_press_cb (GtkTreeView *treeview,
return TRUE;
}
- else if (view->priv->searchable_data_column != -1 &&
- gdk_keyval_to_unicode (event->keyval))
+ else if (view->priv->searchable_data_column != -1 && unicode)
{
- return ephy_node_view_select_node_by_key (view, event);
+ return ephy_gui_select_row_by_key
+ (treeview, view->priv->searchable_data_column, unicode);
}
return FALSE;
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 0cc0158a0..810bb9cb2 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -30,9 +30,17 @@
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkactiongroup.h>
-#include <gtk/gtktoggleaction.h>
+#include <gtk/gtkcombobox.h>
#include <gtk/gtkuimanager.h>
#include <gtk/gtktoggleaction.h>
+#include <gtk/gtktreeselection.h>
+#include <gtk/gtktreemodelsort.h>
+#include <gtk/gtkcelllayout.h>
+#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtkradioaction.h>
+#include <gtk/gtkclipboard.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtktreemodelsort.h>
#include <gdk/gdkkeysyms.h>
#include <glib/gi18n.h>
#include <libgnomeui/gnome-stock-icons.h>
diff --git a/src/bookmarks/ephy-new-bookmark.c b/src/bookmarks/ephy-new-bookmark.c
index 341fdd2c5..9723690b9 100644
--- a/src/bookmarks/ephy-new-bookmark.c
+++ b/src/bookmarks/ephy-new-bookmark.c
@@ -28,6 +28,7 @@
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkstock.h>
+#include <gtk/gtkimage.h>
#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkeditable.h>
#include <glib/gi18n.h>
diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c
index 8d15a59b2..007a3a05d 100644
--- a/src/bookmarks/ephy-topics-selector.c
+++ b/src/bookmarks/ephy-topics-selector.c
@@ -25,6 +25,7 @@
#include "ephy-topics-selector.h"
#include "ephy-debug.h"
#include "ephy-node-view.h"
+#include "ephy-gui.h"
#include <glib/gi18n.h>
#include <gtk/gtkliststore.h>
@@ -325,6 +326,7 @@ topic_key_pressed (GtkTreeView *tree_view,
GtkTreeSelection *sel = NULL;
GtkTreeIter iter;
GtkTreePath *path;
+ guint32 unicode;
switch (event->keyval)
{
@@ -347,6 +349,12 @@ topic_key_pressed (GtkTreeView *tree_view,
break;
}
+ unicode = gdk_keyval_to_unicode (event->keyval);
+ if (unicode)
+ {
+ return ephy_gui_select_row_by_key (tree_view, COL_TOPIC, unicode);
+ }
+
return FALSE;
}
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 98914f857..76da44ec3 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -24,6 +24,14 @@
#include <gtk/gtktable.h>
#include <gtk/gtklabel.h>
+#include <gtk/gtkradioaction.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkalignment.h>
+#include <gtk/gtktreeselection.h>
+#include <gtk/gtkhpaned.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtkimage.h>
+#include <gtk/gtkclipboard.h>
#include <gtk/gtkstock.h>
#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkhbox.h>
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index 89eda8f8c..60ec410a3 100755
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -34,6 +34,11 @@
#include "ephy-debug.h"
#include "ephy-state.h"
+#include <gtk/gtkbox.h>
+#include <gtk/gtkstock.h>
+#include <gtk/gtktable.h>
+#include <gtk/gtktreeselection.h>
+#include <gtk/gtkdialog.h>
#include <gtk/gtktreeview.h>
#include <gtk/gtkliststore.h>
#include <gtk/gtkcellrenderertext.h>
diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c
index f3f93f7a5..70603ea67 100755
--- a/src/ppview-toolbar.c
+++ b/src/ppview-toolbar.c
@@ -25,12 +25,12 @@
#include "ppview-toolbar.h"
#include "ephy-window.h"
#include "ephy-string.h"
-#include "ephy-gui.h"
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtkentry.h>
#include <gtk/gtkmenu.h>
+#include <gtk/gtkstock.h>
#include <gtk/gtkuimanager.h>
static void ppview_toolbar_class_init (PPViewToolbarClass *klass);
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 1f14b3c8c..8b715692e 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -44,6 +44,9 @@
#include "ephy-tree-model-sort.h"
#include <glib/gi18n.h>
+#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtkcelllayout.h>
+#include <gtk/gtktreeselection.h>
#include <gtk/gtkframe.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
diff --git a/src/window-commands.c b/src/window-commands.c
index 41f0c481b..4a6528cda 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -53,6 +53,8 @@
#include <libgnomeui/gnome-stock-icons.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <gtk/gtkeditable.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkicontheme.h>
#include <gtk/gtktoggleaction.h>
#include <libgnomeui/gnome-about.h>
#include <glib/gi18n.h>