Remove ghosts after bookmark edit. Merge edit/ delete callbacks
This commit is contained in:
parent
4e0c1396a0
commit
ad5066a43f
2 changed files with 14 additions and 45 deletions
|
@ -700,7 +700,7 @@ midori_browser_edit_bookmark_add_speed_dial_cb (GtkWidget* button,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Private function, used by MidoriBookmarks and MidoriHistory */
|
/* Private function, used by MidoriBookmarks and MidoriHistory */
|
||||||
/* static */ void
|
/* static */ gboolean
|
||||||
midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
|
midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
|
||||||
KatzeItem* bookmark,
|
KatzeItem* bookmark,
|
||||||
gboolean new_bookmark,
|
gboolean new_bookmark,
|
||||||
|
@ -720,12 +720,13 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
|
||||||
GtkWidget* combo_folder;
|
GtkWidget* combo_folder;
|
||||||
GtkWidget* check_toolbar;
|
GtkWidget* check_toolbar;
|
||||||
GtkWidget* check_app;
|
GtkWidget* check_app;
|
||||||
|
gboolean return_status = FALSE;
|
||||||
#if HAVE_SQLITE
|
#if HAVE_SQLITE
|
||||||
sqlite3* db;
|
sqlite3* db;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser)))
|
if (!browser->bookmarks || !gtk_widget_get_visible (GTK_WIDGET (browser)))
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
#if HAVE_SQLITE
|
#if HAVE_SQLITE
|
||||||
db = g_object_get_data (G_OBJECT (browser->bookmarks), "db");
|
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);
|
_action_set_active (browser, "Bookmarkbar", TRUE);
|
||||||
#endif
|
#endif
|
||||||
g_free (selected);
|
g_free (selected);
|
||||||
|
return_status = TRUE;
|
||||||
}
|
}
|
||||||
gtk_widget_destroy (dialog);
|
gtk_widget_destroy (dialog);
|
||||||
|
return return_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WEBKIT_CHECK_VERSION (1, 1, 3)
|
#if WEBKIT_CHECK_VERSION (1, 1, 3)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <gdk/gdkkeysyms.h>
|
#include <gdk/gdkkeysyms.h>
|
||||||
|
|
||||||
void
|
gboolean
|
||||||
midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
|
midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
|
||||||
KatzeItem* bookmark,
|
KatzeItem* bookmark,
|
||||||
gboolean new_bookmark,
|
gboolean new_bookmark,
|
||||||
|
@ -303,9 +303,12 @@ midori_bookmarks_edit_clicked_cb (GtkWidget* toolitem,
|
||||||
|
|
||||||
g_assert (!KATZE_ITEM_IS_SEPARATOR (item));
|
g_assert (!KATZE_ITEM_IS_SEPARATOR (item));
|
||||||
|
|
||||||
browser = midori_browser_get_for_widget (toolitem);
|
browser = midori_browser_get_for_widget (bookmarks->treeview);
|
||||||
midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, KATZE_ITEM_IS_FOLDER (item));
|
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);
|
g_object_unref (item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -695,43 +698,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
|
static void
|
||||||
midori_bookmarks_popup (GtkWidget* widget,
|
midori_bookmarks_popup (GtkWidget* widget,
|
||||||
GdkEventButton* event,
|
GdkEventButton* event,
|
||||||
|
@ -759,9 +725,9 @@ midori_bookmarks_popup (GtkWidget* widget,
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||||
gtk_widget_show (menuitem);
|
gtk_widget_show (menuitem);
|
||||||
midori_bookmarks_popup_item (menu, GTK_STOCK_EDIT, NULL,
|
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,
|
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);
|
katze_widget_popup (widget, GTK_MENU (menu), event, KATZE_MENU_POSITION_CURSOR);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue