[Xfce4-commits] <midori:master> Remove ghosts after bookmark edit. Merge edit/ delete callbacks

Christian Dywan noreply at xfce.org
Fri Jul 2 23:36:05 CEST 2010


Updating branch refs/heads/master
         to ad5066a43fa8baeb25f64afcce3c2b1582455f6e (commit)
       from 4e0c1396a094ba47cdcf3f80040b5a7777c5177d (commit)

commit ad5066a43fa8baeb25f64afcce3c2b1582455f6e
Author: Alexander Butenko <a.butenka at gmail.com>
Date:   Fri Jul 2 00:50:14 2010 -0400

    Remove ghosts after bookmark edit. Merge edit/ delete callbacks

 midori/midori-browser.c   |    7 ++++-
 panels/midori-bookmarks.c |   52 +++++++-------------------------------------
 2 files changed, 14 insertions(+), 45 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index d043310..eb73654 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -700,7 +700,7 @@ midori_browser_edit_bookmark_add_speed_dial_cb (GtkWidget* button,
 }
 
 /* Private function, used by MidoriBookmarks and MidoriHistory */
-/* static */ void
+/* static */ gboolean
 midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
                                          KatzeItem*     bookmark,
                                          gboolean       new_bookmark,
@@ -720,12 +720,13 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
     GtkWidget* combo_folder;
     GtkWidget* check_toolbar;
     GtkWidget* check_app;
+    gboolean return_status = FALSE;
     #if HAVE_SQLITE
     sqlite3* db;
     #endif
 
     if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser)))
-        return;
+        return FALSE;
 
     #if HAVE_SQLITE
     db = g_object_get_data (G_OBJECT (browser->bookmarks), "db");
@@ -954,8 +955,10 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
                 _action_set_active (browser, "Bookmarkbar", TRUE);
         #endif
         g_free (selected);
+        return_status = TRUE;
     }
     gtk_widget_destroy (dialog);
+    return return_status;
 }
 
 #if WEBKIT_CHECK_VERSION (1, 1, 3)
diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c
index 0604fcd..33687c2 100644
--- a/panels/midori-bookmarks.c
+++ b/panels/midori-bookmarks.c
@@ -25,7 +25,7 @@
 
 #include <gdk/gdkkeysyms.h>
 
-void
+gboolean
 midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
                                          KatzeItem*     bookmark,
                                          gboolean       new_bookmark,
@@ -303,9 +303,12 @@ midori_bookmarks_edit_clicked_cb (GtkWidget*       toolitem,
 
         g_assert (!KATZE_ITEM_IS_SEPARATOR (item));
 
-        browser = midori_browser_get_for_widget (toolitem);
-        midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, KATZE_ITEM_IS_FOLDER (item));
-
+        browser = midori_browser_get_for_widget (bookmarks->treeview);
+        if (midori_browser_edit_bookmark_dialog_new (
+            browser, item, FALSE, KATZE_ITEM_IS_FOLDER (item)))
+        {
+            gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
+        }
         g_object_unref (item);
     }
 }
@@ -696,43 +699,6 @@ midori_bookmarks_open_in_window_activate_cb (GtkWidget*       menuitem,
 }
 
 static void
-midori_bookmarks_edit_activate_cb (GtkWidget*       menuitem,
-                                   MidoriBookmarks* bookmarks)
-{
-    KatzeItem* item;
-    MidoriBrowser* browser;
-
-    item = (KatzeItem*)g_object_get_data (G_OBJECT (menuitem), "KatzeItem");
-    g_assert (!KATZE_ITEM_IS_SEPARATOR (item));
-
-    browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks));
-    midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, KATZE_ITEM_IS_FOLDER (item));
-}
-
-static void
-midori_bookmarks_delete_activate_cb (GtkWidget*       menuitem,
-                                     MidoriBookmarks* bookmarks)
-{
-    KatzeItem* item;
-    #if HAVE_SQLITE
-    sqlite3* db;
-    #endif
-    GtkTreeModel* model;
-    GtkTreeIter iter;
-
-    if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (bookmarks->treeview),
-                                           &model, &iter))
-    {
-        item = (KatzeItem*)g_object_get_data (G_OBJECT (menuitem), "KatzeItem");
-        #if HAVE_SQLITE
-        db = g_object_get_data (G_OBJECT (bookmarks->array), "db");
-        midori_bookmarks_remove_item_from_db (db, item);
-        #endif
-        gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
-    }
-}
-
-static void
 midori_bookmarks_popup (GtkWidget*       widget,
                         GdkEventButton*  event,
                         KatzeItem*       item,
@@ -759,9 +725,9 @@ midori_bookmarks_popup (GtkWidget*       widget,
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
     gtk_widget_show (menuitem);
     midori_bookmarks_popup_item (menu, GTK_STOCK_EDIT, NULL,
-        item, midori_bookmarks_edit_activate_cb, bookmarks);
+        item, midori_bookmarks_edit_clicked_cb, bookmarks);
     midori_bookmarks_popup_item (menu, GTK_STOCK_DELETE, NULL,
-        item, midori_bookmarks_delete_activate_cb, bookmarks);
+        item, midori_bookmarks_delete_clicked_cb, bookmarks);
 
     katze_widget_popup (widget, GTK_MENU (menu), event, KATZE_MENU_POSITION_CURSOR);
 }



More information about the Xfce4-commits mailing list