Render bookmark dialog as a pop-over on buttons
This commit is contained in:
parent
7d4cdfe462
commit
2fa5059cc4
3 changed files with 43 additions and 21 deletions
|
@ -742,7 +742,8 @@ midori_browser_edit_bookmark_add_speed_dial_cb (GtkWidget* button,
|
||||||
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,
|
||||||
gboolean is_folder)
|
gboolean is_folder,
|
||||||
|
GtkWidget* proxy)
|
||||||
{
|
{
|
||||||
const gchar* title;
|
const gchar* title;
|
||||||
GtkWidget* dialog;
|
GtkWidget* dialog;
|
||||||
|
@ -772,12 +773,23 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
|
||||||
title = new_bookmark ? _("New folder") : _("Edit folder");
|
title = new_bookmark ? _("New folder") : _("Edit folder");
|
||||||
else
|
else
|
||||||
title = new_bookmark ? _("New bookmark") : _("Edit bookmark");
|
title = new_bookmark ? _("New bookmark") : _("Edit bookmark");
|
||||||
dialog = gtk_dialog_new_with_buttons (
|
#ifdef HAVE_GRANITE
|
||||||
title, GTK_WINDOW (browser),
|
if (proxy != NULL)
|
||||||
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
|
{
|
||||||
|
/* FIXME: granite: should return GtkWidget* like GTK+ */
|
||||||
|
dialog = (GtkWidget*)granite_widgets_pop_over_new ();
|
||||||
|
granite_widgets_pop_over_move_to_widget (
|
||||||
|
GRANITE_WIDGETS_POP_OVER (dialog), proxy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (browser),
|
||||||
|
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, NULL);
|
||||||
|
}
|
||||||
|
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
new_bookmark ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
|
new_bookmark ? GTK_STOCK_ADD : GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
|
||||||
NULL);
|
|
||||||
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||||
gtk_window_set_icon_name (GTK_WINDOW (dialog),
|
gtk_window_set_icon_name (GTK_WINDOW (dialog),
|
||||||
new_bookmark ? GTK_STOCK_ADD : GTK_STOCK_REMOVE);
|
new_bookmark ? GTK_STOCK_ADD : GTK_STOCK_REMOVE);
|
||||||
|
@ -3877,13 +3889,11 @@ _action_search_activate (GtkAction* action,
|
||||||
MidoriBrowser* browser)
|
MidoriBrowser* browser)
|
||||||
{
|
{
|
||||||
GSList* proxies = gtk_action_get_proxies (action);
|
GSList* proxies = gtk_action_get_proxies (action);
|
||||||
guint i = 0;
|
|
||||||
GtkWidget* proxy;
|
|
||||||
const gchar* uri;
|
const gchar* uri;
|
||||||
gchar* search;
|
gchar* search;
|
||||||
|
|
||||||
while (((proxy = g_slist_nth_data (proxies, i++))))
|
for (; proxies != NULL; proxies = g_slist_next (proxies))
|
||||||
if (GTK_IS_TOOL_ITEM (proxy))
|
if (GTK_IS_TOOL_ITEM (proxies->data))
|
||||||
{
|
{
|
||||||
if (!gtk_widget_get_visible (browser->navigationbar))
|
if (!gtk_widget_get_visible (browser->navigationbar))
|
||||||
gtk_widget_show (browser->navigationbar);
|
gtk_widget_show (browser->navigationbar);
|
||||||
|
@ -4040,9 +4050,9 @@ midori_browser_bookmark_edit_activate_cb (GtkWidget* menuitem,
|
||||||
item = (KatzeItem*)g_object_get_data (G_OBJECT (menuitem), "KatzeItem");
|
item = (KatzeItem*)g_object_get_data (G_OBJECT (menuitem), "KatzeItem");
|
||||||
|
|
||||||
if (KATZE_ITEM_IS_BOOKMARK (item))
|
if (KATZE_ITEM_IS_BOOKMARK (item))
|
||||||
midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, FALSE);
|
midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, FALSE, NULL);
|
||||||
else
|
else
|
||||||
midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, TRUE);
|
midori_browser_edit_bookmark_dialog_new (browser, item, FALSE, TRUE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -4140,10 +4150,19 @@ static void
|
||||||
_action_bookmark_add_activate (GtkAction* action,
|
_action_bookmark_add_activate (GtkAction* action,
|
||||||
MidoriBrowser* browser)
|
MidoriBrowser* browser)
|
||||||
{
|
{
|
||||||
|
GtkWidget* proxy = NULL;
|
||||||
|
GSList* proxies = gtk_action_get_proxies (action);
|
||||||
|
for (; proxies != NULL; proxies = g_slist_next (proxies))
|
||||||
|
if (GTK_IS_TOOL_ITEM (proxies->data))
|
||||||
|
{
|
||||||
|
proxy = proxies->data;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_str_equal (gtk_action_get_name (action), "BookmarkFolderAdd"))
|
if (g_str_equal (gtk_action_get_name (action), "BookmarkFolderAdd"))
|
||||||
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, TRUE);
|
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, TRUE, proxy);
|
||||||
else
|
else
|
||||||
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
|
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE, proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -29,7 +29,8 @@ 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,
|
||||||
gboolean is_folder);
|
gboolean is_folder,
|
||||||
|
GtkWidget* proxy);
|
||||||
|
|
||||||
void
|
void
|
||||||
midori_browser_open_bookmark (MidoriBrowser* browser,
|
midori_browser_open_bookmark (MidoriBrowser* browser,
|
||||||
|
@ -341,9 +342,9 @@ midori_bookmarks_add_clicked_cb (GtkWidget* toolitem)
|
||||||
MidoriBrowser* browser = midori_browser_get_for_widget (toolitem);
|
MidoriBrowser* browser = midori_browser_get_for_widget (toolitem);
|
||||||
/* FIXME: Take selected folder into account */
|
/* FIXME: Take selected folder into account */
|
||||||
if (g_str_equal (gtk_widget_get_name (toolitem), "BookmarkFolderAdd"))
|
if (g_str_equal (gtk_widget_get_name (toolitem), "BookmarkFolderAdd"))
|
||||||
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, TRUE);
|
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, TRUE, toolitem);
|
||||||
else
|
else
|
||||||
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
|
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE, toolitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -365,7 +366,7 @@ midori_bookmarks_edit_clicked_cb (GtkWidget* toolitem,
|
||||||
|
|
||||||
browser = midori_browser_get_for_widget (bookmarks->treeview);
|
browser = midori_browser_get_for_widget (bookmarks->treeview);
|
||||||
midori_browser_edit_bookmark_dialog_new (
|
midori_browser_edit_bookmark_dialog_new (
|
||||||
browser, item, FALSE, KATZE_ITEM_IS_FOLDER (item));
|
browser, item, FALSE, KATZE_ITEM_IS_FOLDER (item), NULL);
|
||||||
g_object_unref (item);
|
g_object_unref (item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ void
|
||||||
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,
|
||||||
gboolean is_folder);
|
gboolean is_folder,
|
||||||
|
GtkWidget* proxy);
|
||||||
|
|
||||||
|
|
||||||
struct _MidoriHistory
|
struct _MidoriHistory
|
||||||
|
@ -373,6 +374,7 @@ midori_history_bookmark_add_cb (GtkWidget* menuitem,
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
KatzeItem* item = NULL;
|
KatzeItem* item = NULL;
|
||||||
|
|
||||||
|
GtkWidget* proxy = GTK_IS_TOOL_ITEM (menuitem) ? menuitem : NULL;
|
||||||
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (history));
|
MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (history));
|
||||||
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (history->treeview),
|
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (history->treeview),
|
||||||
&model, &iter))
|
&model, &iter))
|
||||||
|
@ -380,11 +382,11 @@ midori_history_bookmark_add_cb (GtkWidget* menuitem,
|
||||||
|
|
||||||
if (KATZE_IS_ITEM (item) && katze_item_get_uri (item))
|
if (KATZE_IS_ITEM (item) && katze_item_get_uri (item))
|
||||||
{
|
{
|
||||||
midori_browser_edit_bookmark_dialog_new (browser, item, TRUE, FALSE);
|
midori_browser_edit_bookmark_dialog_new (browser, item, TRUE, FALSE, proxy);
|
||||||
g_object_unref (item);
|
g_object_unref (item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE);
|
midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE, proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget*
|
static GtkWidget*
|
||||||
|
|
Loading…
Reference in a new issue