]> spindle.queued.net Git - midori/commitdiff
Move {sokoke,katze}_tree_view_get_selected_iter proper
authorChristian Dywan <christian@twotoasts.de>
Wed, 28 Jan 2009 00:08:51 +0000 (01:08 +0100)
committerChristian Dywan <christian@twotoasts.de>
Wed, 28 Jan 2009 00:08:51 +0000 (01:08 +0100)
katze/katze-utils.c
katze/katze-utils.h
midori/midori-browser.c
midori/sokoke.c
midori/sokoke.h
panels/midori-extensions.c

index df5be8f34903acfa040c9eb4a4f633ae86cebf11..cebbf0741e82f56d6fa34dccc65f4a052585c3f6 100644 (file)
@@ -572,6 +572,40 @@ katze_pixbuf_new_from_buffer (const guchar* buffer,
     return pixbuf;
 }
 
+/**
+ * katze_tree_view_get_selected_iter:
+ * @treeview: a #GtkTreeView
+ * @model: a pointer to store the model, or %NULL
+ * @iter: a pointer to store the iter, or %NULL
+ *
+ * Determines whether there is a selection in @treeview
+ * and sets the @iter to the current selection.
+ *
+ * If there is a selection and @model is not %NULL, it is
+ * set to the model, mainly for convenience.
+ *
+ * Either @model or @iter or both can be %NULL in which case
+ * no value will be assigned in any case.
+ *
+ * Return value: %TRUE if there is a selection
+ *
+ * Since: 0.1.3
+ **/
+gboolean
+katze_tree_view_get_selected_iter (GtkTreeView*   treeview,
+                                   GtkTreeModel** model,
+                                   GtkTreeIter*   iter)
+{
+    GtkTreeSelection* selection;
+
+    g_return_val_if_fail (GTK_IS_TREE_VIEW (treeview), FALSE);
+
+    if ((selection = gtk_tree_view_get_selection (treeview)))
+        if (gtk_tree_selection_get_selected (selection, model, iter))
+            return TRUE;
+    return FALSE;
+}
+
 /**
  * katze_object_has_property:
  * @object: a #GObject
index d38f8c9252c6d0934e3c99cf179aee7487ca10ea..f5f73b6c2a34bb12a1b18f7a51fe83dd39c5a302 100644 (file)
@@ -84,6 +84,11 @@ katze_pixbuf_new_from_buffer         (const guchar* buffer,
                                       const gchar*  mime_type,
                                       GError**      error);
 
+gboolean
+katze_tree_view_get_selected_iter    (GtkTreeView*    treeview,
+                                      GtkTreeModel**  model,
+                                      GtkTreeIter*    iter);
+
 gboolean
 katze_object_has_property            (gpointer     object,
                                       const gchar* property);
index 6123046b7da27d3629adcf55c1fba31e26a405cc..229e053cfcaf91e37875054074ea1f724bd168a9 100644 (file)
@@ -2371,7 +2371,7 @@ midori_panel_bookmarks_cursor_or_row_changed_cb (GtkTreeView*   tree_view,
     KatzeItem* item;
     gboolean is_separator;
 
-    if (sokoke_tree_view_get_selected_iter (tree_view, &model, &iter))
+    if (katze_tree_view_get_selected_iter (tree_view, &model, &iter))
     {
         gtk_tree_model_get (model, &iter, 0, &item, -1);
 
@@ -2527,7 +2527,7 @@ midori_browser_history_delete (MidoriBrowser* browser)
     GtkAction* location_action;
 
     treeview = GTK_TREE_VIEW (browser->panel_history);
-    if (sokoke_tree_view_get_selected_iter (treeview, &model, &iter))
+    if (katze_tree_view_get_selected_iter (treeview, &model, &iter))
     {
         location_action = _action_by_name (browser, "Location");
         gtk_tree_model_get (model, &iter, 0, &item, -1);
@@ -2617,7 +2617,7 @@ midori_panel_bookmarks_button_release_event_cb (GtkWidget*      widget,
     if (event->button != 2 && event->button != 3)
         return FALSE;
 
-    if (sokoke_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
+    if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
     {
         gtk_tree_model_get (model, &iter, 0, &item, -1);
         uri = katze_item_get_uri (item);
@@ -2644,7 +2644,7 @@ midori_panel_bookmarks_popup_menu_cb (GtkWidget*     widget,
     GtkTreeIter iter;
     KatzeItem* item;
 
-    if (sokoke_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
+    if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
     {
         gtk_tree_model_get (model, &iter, 0, &item, -1);
         midori_browser_bookmark_popup (widget, NULL, item, FALSE, browser);
@@ -2684,7 +2684,7 @@ midori_panel_history_cursor_or_row_changed_cb (GtkTreeView*   tree_view,
     KatzeItem* item;
     gboolean is_page;
 
-    if (sokoke_tree_view_get_selected_iter (tree_view, &model, &iter))
+    if (katze_tree_view_get_selected_iter (tree_view, &model, &iter))
     {
         gtk_tree_model_get (model, &iter, 0, &item, -1);
 
@@ -2720,7 +2720,7 @@ midori_panel_history_button_release_event_cb (GtkWidget*      widget,
     if (event->button != 2 && event->button != 3)
         return FALSE;
 
-    if (sokoke_tree_view_get_selected_iter (GTK_TREE_VIEW (widget),
+    if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget),
                                             &model, &iter))
     {
         gtk_tree_model_get (model, &iter, 0, &item, -1);
@@ -2757,7 +2757,7 @@ midori_panel_history_key_release_event_cb (GtkWidget*     widget,
         return FALSE;
 
     treeview = GTK_TREE_VIEW (widget);
-    if (sokoke_tree_view_get_selected_iter (treeview, &model, &iter))
+    if (katze_tree_view_get_selected_iter (treeview, &model, &iter))
     {
         location_action = _action_by_name (browser, "Location");
         gtk_tree_model_get (model, &iter, 0, &item, -1);
@@ -2777,7 +2777,7 @@ midori_panel_history_popup_menu_cb (GtkWidget*     widget,
     GtkTreeIter iter;
     KatzeItem* item;
 
-    if (sokoke_tree_view_get_selected_iter (GTK_TREE_VIEW (widget),
+    if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget),
                                             &model, &iter))
     {
         gtk_tree_model_get (model, &iter, 0, &item, -1);
@@ -3213,7 +3213,7 @@ _action_history_add_bookmark_activate (GtkAction*     action,
     KatzeItem* item;
 
     tree_view = GTK_TREE_VIEW (browser->panel_history);
-    if (sokoke_tree_view_get_selected_iter (tree_view, &model, &iter))
+    if (katze_tree_view_get_selected_iter (tree_view, &model, &iter))
     {
         gtk_tree_model_get (model, &iter, 0, &item, -1);
         if (!KATZE_IS_ARRAY (item))
@@ -3257,7 +3257,7 @@ _action_bookmark_edit_activate (GtkAction*     action,
     KatzeItem* item;
 
     tree_view = GTK_TREE_VIEW (browser->panel_bookmarks);
-    if (sokoke_tree_view_get_selected_iter (tree_view, &model, &iter))
+    if (katze_tree_view_get_selected_iter (tree_view, &model, &iter))
     {
         gtk_tree_model_get (model, &iter, 0, &item, -1);
         if (KATZE_IS_ARRAY (item) || katze_item_get_uri (item))
@@ -3276,7 +3276,7 @@ _action_bookmark_delete_activate (GtkAction*     action,
     KatzeArray* parent;
 
     tree_view = GTK_TREE_VIEW (browser->panel_bookmarks);
-    if (sokoke_tree_view_get_selected_iter (tree_view, &model, &iter))
+    if (katze_tree_view_get_selected_iter (tree_view, &model, &iter))
     {
         gtk_tree_model_get (model, &iter, 0, &item, -1);
         parent = katze_item_get_parent (item);
index 3aa80561ae55f79131f5240f17595047aa2c08f9..78f822cd392bd1704faa257cb776019fdc1b5596 100644 (file)
@@ -629,39 +629,6 @@ sokoke_image_menu_item_new_ellipsized (const gchar* label)
     return katze_image_menu_item_new_ellipsized (label);
 }
 
-/**
- * sokoke_tree_view_get_selected_iter:
- * @tree_view: a #GtkTreeView
- * @model: a pointer to store the model, or %NULL
- * @iter: a pointer to store the iter, or %NULL
- *
- * Determines whether there is a selection in the tree view
- * and sets the @iter to the current selection.
- *
- * If there is a selection and @model is not %NULL, it is
- * set to the model, mainly for convenience.
- *
- * Either @model or @iter or both can be %NULL in which case
- * no value will be assigned in any case.
- *
- * Return value: %TRUE if there is a selection
- **/
-gboolean
-sokoke_tree_view_get_selected_iter (GtkTreeView*   tree_view,
-                                    GtkTreeModel** model,
-                                    GtkTreeIter*   iter)
-{
-    GtkTreeSelection* selection;
-
-    g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
-
-    selection = gtk_tree_view_get_selection (tree_view);
-    if (selection)
-        if (gtk_tree_selection_get_selected (selection, model, iter))
-            return TRUE;
-    return FALSE;
-}
-
 /**
  * sokoke_time_t_to_julian:
  * @timestamp: a time_t timestamp value
index 3f1fbb3050cd38dac8662c401c542ffb52d46b06..13190475da354d1b6f68f1bb926457d170672db2 100644 (file)
@@ -121,11 +121,6 @@ sokoke_action_create_popup_menu_item (GtkAction*     action);
 GtkWidget*
 sokoke_image_menu_item_new_ellipsized (const gchar*  label);
 
-gboolean
-sokoke_tree_view_get_selected_iter   (GtkTreeView*   tree_view,
-                                      GtkTreeModel** model,
-                                      GtkTreeIter*   iter);
-
 gint64
 sokoke_time_t_to_julian              (const time_t*  timestamp);
 
index c615c0d7411c8f8e71991e1e8831d7e503dc91f6..3a9e96df25e1ad47deeeb7be4c0ac02caa75abe4 100644 (file)
@@ -104,7 +104,7 @@ midori_extensions_button_status_clicked_cb (GtkToolItem*      toolitem,
 
     treeview = GTK_TREE_VIEW (extensions->treeview);
 
-    if (sokoke_tree_view_get_selected_iter (treeview, &model, &iter))
+    if (katze_tree_view_get_selected_iter (treeview, &model, &iter))
     {
         GtkToolItem* button_enable = gtk_toolbar_get_nth_item (
             GTK_TOOLBAR (extensions->toolbar), 1);