diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-06-11 03:16:31 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-06-11 03:16:31 +0800 |
commit | c6214a25b44f09d1a33c0554dfb3a555c555b70f (patch) | |
tree | 3d0e569210253cdb697aaa624604f7d39f0c9a19 /src | |
parent | a2a5043584b00f1ee879c41162ec76060df74bc0 (diff) | |
download | gsoc2013-epiphany-c6214a25b44f09d1a33c0554dfb3a555c555b70f.tar gsoc2013-epiphany-c6214a25b44f09d1a33c0554dfb3a555c555b70f.tar.gz gsoc2013-epiphany-c6214a25b44f09d1a33c0554dfb3a555c555b70f.tar.bz2 gsoc2013-epiphany-c6214a25b44f09d1a33c0554dfb3a555c555b70f.tar.lz gsoc2013-epiphany-c6214a25b44f09d1a33c0554dfb3a555c555b70f.tar.xz gsoc2013-epiphany-c6214a25b44f09d1a33c0554dfb3a555c555b70f.tar.zst gsoc2013-epiphany-c6214a25b44f09d1a33c0554dfb3a555c555b70f.zip |
Small cleanups. Dont crash when adding a bookmark without topics.
2003-06-10 Marco Pesenti Gritti <marco@it.gnome.org>
* src/bookmarks/ephy-topics-selector.c:
(ephy_topics_selector_apply), (topic_clicked), (topic_key_pressed),
(ephy_topics_build_ui), (ephy_topics_selector_new):
Small cleanups. Dont crash when adding a bookmark without topics.
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/ephy-topics-selector.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/bookmarks/ephy-topics-selector.c b/src/bookmarks/ephy-topics-selector.c index cacf9a1b5..a43622cd5 100644 --- a/src/bookmarks/ephy-topics-selector.c +++ b/src/bookmarks/ephy-topics-selector.c @@ -60,7 +60,7 @@ enum COL_HAS_TOPIC, COL_TOPIC, COL_NODE -};; +}; static GObjectClass *parent_class = NULL; @@ -267,7 +267,11 @@ ephy_topics_selector_apply (EphyTopicsSelector *editor) if (editor->priv->bookmark == NULL) return; - gtk_tree_model_get_iter_first (model, &iter); + if (!gtk_tree_model_get_iter_first (model, &iter)) + { + return; + } + do { GValue value = { 0, }; @@ -299,15 +303,15 @@ ephy_topics_selector_apply (EphyTopicsSelector *editor) } static gboolean -topic_clicked (GtkTreeView *tree_view, - GdkEventButton *event, - EphyTopicsSelector *selector) +topic_clicked (GtkTreeView *tree_view, + GdkEventButton *event, + EphyTopicsSelector *selector) { GtkTreePath *path; if (event->window != gtk_tree_view_get_bin_window (tree_view)) return FALSE; - + if (gtk_tree_view_get_path_at_pos (tree_view, (gint) event->x, (gint) event->y, @@ -318,12 +322,12 @@ topic_clicked (GtkTreeView *tree_view, topic_toggled (NULL, path_str, selector); g_free(path_str); } - + return FALSE; } static gboolean -topic_key_pressed (GtkTreeView *tree_view, +topic_key_pressed (GtkTreeView *tree_view, GdkEventKey *event, EphyTopicsSelector *selector) { @@ -332,13 +336,13 @@ topic_key_pressed (GtkTreeView *tree_view, GtkTreePath *path = NULL; gchar *path_str; - switch (event->keyval) + switch (event->keyval) { case GDK_space: case GDK_Return: case GDK_KP_Enter: sel = gtk_tree_view_get_selection (tree_view); - + if (gtk_tree_selection_get_selected (sel, NULL, &iter)) { path = gtk_tree_model_get_path (selector->priv->model, &iter); @@ -351,8 +355,8 @@ topic_key_pressed (GtkTreeView *tree_view, default: break; } - - return FALSE; + + return FALSE; } static void @@ -382,7 +386,7 @@ ephy_topics_build_ui (EphyTopicsSelector *editor) column = gtk_tree_view_column_new_with_attributes ("Description", renderer, "text", COL_TOPIC, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (editor), column); - + g_signal_connect (G_OBJECT (editor), "key_press_event", G_CALLBACK (topic_key_pressed), editor); g_signal_connect (G_OBJECT (editor), "button_press_event", @@ -413,6 +417,6 @@ ephy_topics_selector_new (EphyBookmarks *bookmarks, NULL)); ephy_topics_build_ui (editor); - + return GTK_WIDGET (editor); } |