Merge lp:~aauzi/midori/fix-1177553-2 into lp:midori

Proposed by André Auzi
Status: Merged
Approved by: Cris Dywan
Approved revision: 6222
Merged at revision: 6243
Proposed branch: lp:~aauzi/midori/fix-1177553-2
Merge into: lp:midori
Diff against target: 146 lines (+57/-11)
2 files modified
midori/midori-browser.c (+11/-6)
panels/midori-bookmarks.c (+46/-5)
To merge this branch: bzr merge lp:~aauzi/midori/fix-1177553-2
Reviewer Review Type Date Requested Status
Cris Dywan Approve
Midori Devs Pending
Review via email: mp+170704@code.launchpad.net

Commit message

Take current selection into account for bookmark folders when adding/editing bookmark

Description of the change

in midori_bookmarks_add_clicked_cb of panels/midori-bookmarks.c:
 uses the current selection to find the folder a bookmark or folder is added into and passes it as a parameter of midori_browser_edit_bookmark_dialog_new

in midori_browser_edit_bookmark_dialog_new of midori/midori-browser.c:
  when a new bookmark or folder is created initializes its "parentid" meta data with the id of the given bookmark_or_parent parameter.
  call midori_bookmark_folder_button_new without the new_bookmark parameter.
  The parameter 'parentid' corresponds to the newly created or edited bookmarks "parentid" meta data.

in midori_bookmark_folder_button_new:
  remove the case 'new_bookmark, ie. select the given parentid in any case

in _action_bookmarks_import_activate:
  call midori_bookmark_folder_button_new without the new_bookmark parameter.
  The parameter 'parentid' corresponds to the "Bookmarks" (root) folder

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

Looks sensible to me.

review: Approve
Revision history for this message
Cris Dywan (kalikiana) wrote :

I do notice something when creating a new folder:
GLib-CRITICAL **: g_str_has_prefix: assertion `str != NULL' failed

I'm uncertain if this is due to this change or not. I'd appreciate if somebody else can double-check.

Revision history for this message
André Auzi (aauzi) wrote :

Le Sat, 29 Jun 2013 18:36:26 -0000,
Christian Dywan <email address hidden> a écrit :

> I do notice something when creating a new folder:
> GLib-CRITICAL **: g_str_has_prefix: assertion `str != NULL' failed
>
> I'm uncertain if this is due to this change or not. I'd appreciate if
> somebody else can double-check.

Hi kalikiana,

I've checked lp:midori (revno: 6238), it does something very similar:

(midori4:8087): GLib-CRITICAL **: g_str_has_prefix: assertion `str !=
NULL' failed

Revision history for this message
André Auzi (aauzi) wrote :
Download full text (10.7 KiB)

> Le Sat, 29 Jun 2013 18:36:26 -0000,
> Christian Dywan <email address hidden> a écrit :
>
> > I do notice something when creating a new folder:
> > GLib-CRITICAL **: g_str_has_prefix: assertion `str != NULL' failed
> >
> > I'm uncertain if this is due to this change or not. I'd appreciate if
> > somebody else can double-check.
>
> Hi kalikiana,
>
> I've checked lp:midori (revno: 6238), it does something very similar:
>
> (midori4:8087): GLib-CRITICAL **: g_str_has_prefix: assertion `str !=
> NULL' failed

The problem actually comes from the midori_browser_update_history that's done in midori_browser_edit_bookmark_dialog_new.

It calls the function zeitgeist_manifestation_for_uri with the created folder's uri, which is a NULL string.

I wonder if midori_browser_update_history must be done in case of folder creation.

I wonder if it must be done in any case.

Here is the backtrace.

-------------------------------------------------------------------------------
env G_DEBUG=fatal-criticals _build/default/midori/midori -g

** (midori:8329): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-06tODYGRbI: Connexion refusée
Launching command: '/usr/bin/gdb' --batch -ex 'set print thread-events off' -ex run -ex 'set logging on /run/user/1000/midori/gdb.bt' -ex 'bt' --return-child-result --args _build/default/midori/midori
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
warning: cannot close "/usr/lib/gio/modules/libgvfsdbus.so": Opération invalide
warning: cannot close "/lib/libgvfscommon.so.0": Opération invalide
warning: cannot close "/lib/libbluray.so.1": Opération invalide

** (midori:8332): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-06tODYGRbI: Connexion refusée
warning: cannot close "/usr/lib/gio/modules/libgiognomeproxy.so": Opération invalide
warning: cannot close "/usr/lib/gio/modules/libgiolibproxy.so": Opération invalide
warning: cannot close "/lib/libproxy.so.1": Opération invalide
warning: cannot close "/lib/libmodman.so.1": Opération invalide
warning: cannot close "/usr/lib/gio/modules/libgsettingsgconfbackend.so": Opération invalide
warning: cannot close "/lib/libgconf-2.so.4": Opération invalide
Detaching after fork from child process 8339.
warning: cannot close "/usr/lib/gio/modules/libgiognutls.so": Opération invalide
warning: cannot close "/lib/libgnutls.so.26": Opération invalide
warning: cannot close "/lib/libtasn1.so.3": Opération invalide
warning: cannot close "/lib/libfam.so.0": Opération invalide
Detaching after fork from child process 8345.
java version "1.7.0_03"
OpenJDK Runtime Environment (fedora-2.3.9.8.fc18-i386)
OpenJDK Client VM (build 23.7-b01, mixed mode, sharing)

(midori4:8332): Gtk-WARNING **: Error loading theme icon 'text-x-javascript' for stock: L'icône « text-x-javascript » n'est pas présente dans le thème

(midori4:8332): Gtk-WARNING **: Can't set a parent on a toplevel widget

(midori4:8332): GLib-CRITICAL **: g_str_has_prefix: assertion `str != NULL' failed

Program received signal SIGTRAP, Trace/breakpoint trap.
g_logv (log_domain=log_domain@entry=0x41ea5aae "...

Revision history for this message
Cris Dywan (kalikiana) wrote :

I'll propose a separate fix for the g_str_has_prefix issue. This is good to go then. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/midori-browser.c'
2--- midori/midori-browser.c 2013-06-20 20:07:11 +0000
3+++ midori/midori-browser.c 2013-06-20 21:18:27 +0000
4@@ -818,7 +818,6 @@
5
6 static GtkWidget*
7 midori_bookmark_folder_button_new (KatzeArray* array,
8- gboolean new_bookmark,
9 gint64 selected,
10 gint64 parentid)
11 {
12@@ -856,7 +855,7 @@
13 gtk_list_store_insert_with_values (model, NULL, G_MAXINT,
14 0, name, 1, PANGO_ELLIPSIZE_END, 2, id, -1);
15
16- if (!new_bookmark && id == parentid)
17+ if (id == parentid)
18 gtk_combo_box_set_active (GTK_COMBO_BOX (combo), n);
19 n++;
20 }
21@@ -910,11 +909,12 @@
22 /* Private function, used by MidoriBookmarks and MidoriHistory */
23 /* static */ gboolean
24 midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
25- KatzeItem* bookmark,
26+ KatzeItem* bookmark_or_parent,
27 gboolean new_bookmark,
28 gboolean is_folder,
29 GtkWidget* proxy)
30 {
31+ KatzeItem* bookmark = bookmark_or_parent;
32 const gchar* title;
33 GtkWidget* dialog;
34 GtkWidget* content_area;
35@@ -968,7 +968,7 @@
36 gtk_window_set_icon_name (GTK_WINDOW (dialog),
37 new_bookmark ? GTK_STOCK_ADD : GTK_STOCK_REMOVE);
38
39- if (!bookmark)
40+ if (new_bookmark)
41 {
42 view = midori_browser_get_current_tab (browser);
43 if (is_folder)
44@@ -981,6 +981,11 @@
45 bookmark = g_object_new (KATZE_TYPE_ITEM,
46 "uri", midori_view_get_display_uri (MIDORI_VIEW (view)),
47 "name", midori_view_get_display_title (MIDORI_VIEW (view)), NULL);
48+ katze_item_set_meta_integer (
49+ bookmark, "parentid",
50+ (!bookmark_or_parent
51+ ? 0
52+ : katze_item_get_meta_integer (bookmark_or_parent, "id")));
53 }
54
55 entry_title = gtk_entry_new ();
56@@ -1008,7 +1013,7 @@
57 }
58
59 combo_folder = midori_bookmark_folder_button_new (browser->bookmarks,
60- new_bookmark, katze_item_get_meta_integer (bookmark, "id"),
61+ katze_item_get_meta_integer (bookmark, "id"),
62 katze_item_get_meta_integer (bookmark, "parentid"));
63 gtk_box_pack_start (GTK_BOX (vbox), combo_folder, FALSE, FALSE, 0);
64
65@@ -4426,7 +4431,7 @@
66 gtk_widget_show_all (hbox);
67
68 combobox_folder = midori_bookmark_folder_button_new (browser->bookmarks,
69- FALSE, 0, 0);
70+ 0, 0);
71 gtk_container_add (GTK_CONTAINER (content_area), combobox_folder);
72
73 gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
74
75=== modified file 'panels/midori-bookmarks.c'
76--- panels/midori-bookmarks.c 2013-06-13 16:53:19 +0000
77+++ panels/midori-bookmarks.c 2013-06-20 21:18:27 +0000
78@@ -27,7 +27,7 @@
79
80 gboolean
81 midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser,
82- KatzeItem* bookmark,
83+ KatzeItem* bookmark_or_parent,
84 gboolean new_bookmark,
85 gboolean is_folder,
86 GtkWidget* proxy);
87@@ -390,14 +390,55 @@
88 }
89
90 static void
91-midori_bookmarks_add_clicked_cb (GtkWidget* toolitem)
92+midori_bookmarks_add_clicked_cb (GtkWidget* toolitem,
93+ MidoriBookmarks* bookmarks)
94 {
95 MidoriBrowser* browser = midori_browser_get_for_widget (toolitem);
96- /* FIXME: Take selected folder into account */
97+ GtkTreeView* treeview = GTK_TREE_VIEW (bookmarks->treeview);
98+ GtkTreeModel* model;
99+ GtkTreeIter iter;
100+ KatzeItem* parent = NULL;
101+
102+ if (katze_tree_view_get_selected_iter (treeview,
103+ &model, &iter))
104+ {
105+ gboolean done = FALSE;
106+ while (!done)
107+ {
108+ gtk_tree_model_get (model, &iter, 0, &parent, -1);
109+
110+ if (KATZE_ITEM_IS_FOLDER (parent))
111+ {
112+ GtkTreePath* path = gtk_tree_model_get_path(model, &iter);
113+
114+ if (!gtk_tree_view_row_expanded (treeview, path))
115+ gtk_tree_view_expand_row (treeview, path, FALSE);
116+
117+ gtk_tree_path_free (path);
118+ done = TRUE;
119+ }
120+ else
121+ {
122+ GtkTreeIter child = iter;
123+
124+ if (parent) g_object_unref (parent);
125+ parent = NULL;
126+
127+ if (!gtk_tree_model_iter_parent (model, &iter, &child))
128+ {
129+ done = TRUE;
130+ }
131+ }
132+ }
133+ }
134+
135 if (g_str_equal (gtk_widget_get_name (toolitem), "BookmarkFolderAdd"))
136- midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, TRUE, toolitem);
137+ midori_browser_edit_bookmark_dialog_new (browser, parent, TRUE, TRUE, toolitem);
138 else
139- midori_browser_edit_bookmark_dialog_new (browser, NULL, TRUE, FALSE, toolitem);
140+ midori_browser_edit_bookmark_dialog_new (browser, parent, TRUE, FALSE, toolitem);
141+
142+ if (parent)
143+ g_object_unref (parent);
144 }
145
146 static void

Subscribers

People subscribed via source and target branches

to all changes: