g_free (text);
}
-/* Private function, used by MidoriBookmarks */
+/* Private function, used by MidoriBookmarks and MidoriHistory */
/* static */ void
midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
KatzeItem* bookmark,
- gboolean new_bookmark)
+ gboolean new_bookmark,
+ gboolean is_folder)
{
+ const gchar* title;
GtkWidget* dialog;
GtkSizeGroup* sizegroup;
GtkWidget* view;
GtkWidget* entry_uri;
GtkWidget* combo_folder;
+ if (is_folder)
+ title = new_bookmark ? _("New folder") : _("Edit folder");
+ else
+ title = new_bookmark ? _("New bookmark") : _("Edit bookmark");
dialog = gtk_dialog_new_with_buttons (
- new_bookmark ? _("New bookmark") : _("Edit bookmark"),
- GTK_WINDOW (browser),
+ title, GTK_WINDOW (browser),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
new_bookmark ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
if (!bookmark)
{
view = midori_browser_get_current_tab (browser);
- bookmark = g_object_new (KATZE_TYPE_ITEM,
- "uri", midori_view_get_display_uri (MIDORI_VIEW (view)),
- "name", midori_view_get_display_title (MIDORI_VIEW (view)), NULL);
+ if (is_folder)
+ {
+ bookmark = katze_array_new (KATZE_TYPE_ARRAY);
+ katze_item_set_name (bookmark,
+ midori_view_get_display_title (MIDORI_VIEW (view)));
+ }
+ else
+ bookmark = g_object_new (KATZE_TYPE_ITEM,
+ "uri", midori_view_get_display_uri (MIDORI_VIEW (view)),
+ "name", midori_view_get_display_title (MIDORI_VIEW (view)), NULL);
}
hbox = gtk_hbox_new (FALSE, 8);
item = katze_item_new ();
katze_item_set_uri (item, uri);
browser = (MidoriBrowser*)gtk_widget_get_toplevel (menuitem);
- midori_browser_edit_bookmark_dialog_new (browser, item, FALSE);
+ midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, FALSE);
}
static void
item = (KatzeItem*)g_object_get_data (G_OBJECT (menuitem), "KatzeItem");
uri = katze_item_get_uri (item);
- if (KATZE_IS_ARRAY (item) || (uri && *uri))
- midori_browser_edit_bookmark_dialog_new (browser, item, FALSE);
+ if (KATZE_IS_ARRAY (item))
+ midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, TRUE);
+ else if (uri && *uri)
+ midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, FALSE);
}
static void
_action_bookmark_add_activate (GtkAction* action,
MidoriBrowser* browser)
{
- midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE);
+ midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
}
static void
void
midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
KatzeItem* bookmark,
- gboolean new_bookmark);
+ gboolean new_bookmark,
+ gboolean is_folder);
struct _MidoriBookmarks
{
GtkWidget* browser = gtk_widget_get_toplevel (toolitem);
/* FIXME: Take selected folder into account */
midori_browser_edit_bookmark_dialog_new (MIDORI_BROWSER (browser),
- NULL, TRUE);
+ NULL, TRUE, FALSE);
}
static void
{
GtkWidget* browser = gtk_widget_get_toplevel (toolitem);
midori_browser_edit_bookmark_dialog_new (MIDORI_BROWSER (browser),
- item, FALSE);
+ item, FALSE, FALSE);
}
g_object_unref (item);
}
}
+static void
+midori_bookmarks_folder_clicked_cb (GtkWidget* toolitem)
+{
+ GtkWidget* browser = gtk_widget_get_toplevel (toolitem);
+ /* FIXME: Take selected folder into account */
+ midori_browser_edit_bookmark_dialog_new (MIDORI_BROWSER (browser),
+ NULL, TRUE, TRUE);
+}
+
static void
midori_bookmarks_cursor_or_row_changed_cb (GtkTreeView* treeview,
MidoriBookmarks* bookmarks)
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
gtk_widget_show (GTK_WIDGET (toolitem));
bookmarks->delete = GTK_WIDGET (toolitem);
+ toolitem = gtk_separator_tool_item_new ();
+ gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (toolitem), FALSE);
+ gtk_tool_item_set_expand (toolitem, TRUE);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
+ gtk_widget_show (GTK_WIDGET (toolitem));
+ toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DIRECTORY);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
+ _("Add a new folder"));
+ g_signal_connect (toolitem, "clicked",
+ G_CALLBACK (midori_bookmarks_folder_clicked_cb), bookmarks);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
+ gtk_widget_show (GTK_WIDGET (toolitem));
+
midori_bookmarks_cursor_or_row_changed_cb (
GTK_TREE_VIEW (bookmarks->treeview), bookmarks);
g_signal_connect (bookmarks->edit, "destroy",
if (!is_separator)
{
GtkWidget* browser = gtk_widget_get_toplevel (GTK_WIDGET (bookmarks));
- midori_browser_edit_bookmark_dialog_new (MIDORI_BROWSER (browser), item, FALSE);
+ midori_browser_edit_bookmark_dialog_new (MIDORI_BROWSER (browser), item, FALSE, FALSE);
}
}
void
midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
KatzeItem* bookmark,
- gboolean new_bookmark);
+ gboolean new_bookmark,
+ gboolean is_folder);
struct _MidoriHistory
{
GtkWidget* browser = gtk_widget_get_toplevel (toolitem);
/* FIXME: Take selected folder into account */
midori_browser_edit_bookmark_dialog_new (MIDORI_BROWSER (browser),
- NULL, TRUE);
+ NULL, TRUE, FALSE);
}
static void
if (uri && *uri)
{
GtkWidget* browser = gtk_widget_get_toplevel (GTK_WIDGET (history));
- midori_browser_edit_bookmark_dialog_new (MIDORI_BROWSER (browser), item, TRUE);
+ midori_browser_edit_bookmark_dialog_new (MIDORI_BROWSER (browser), item, TRUE, FALSE);
}
}