Merge lp:~nomad-p/midori/fix-bug1182603 into lp:midori

Proposed by Stephan Haller
Status: Merged
Approved by: André Stösel
Approved revision: 6190
Merged at revision: 6211
Proposed branch: lp:~nomad-p/midori/fix-bug1182603
Merge into: lp:midori
Diff against target: 162 lines (+80/-55)
1 file modified
extensions/toolbar-editor.c (+80/-55)
To merge this branch: bzr merge lp:~nomad-p/midori/fix-bug1182603
Reviewer Review Type Date Requested Status
André Stösel Approve
Review via email: mp+166957@code.launchpad.net

Commit message

Do not run toolbar editor's GtkDialog in its own main loop by prevent calling gtk_dialog_run(). Instead just set the GtkDialog modal and show it.

Description of the change

Fixes bug #1182603:
midori becomes inresponsive when cookie bar pops up whilewhile the toolbar editor is open

To post a comment you must log in.
Revision history for this message
André Stösel (ivaldi) wrote :

Works fine now, thank you!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'extensions/toolbar-editor.c'
--- extensions/toolbar-editor.c 2013-03-26 08:01:24 +0000
+++ extensions/toolbar-editor.c 2013-06-02 02:34:25 +0000
@@ -32,6 +32,12 @@
32 MidoriBrowser *browser;32 MidoriBrowser *browser;
33} TBEditorWidget;33} TBEditorWidget;
3434
35typedef struct
36{
37 GSList *used_items, *all_items;
38 TBEditorWidget *tbw;
39} TBEditorWindow;
40
35enum41enum
36{42{
37 TB_EDITOR_COL_ACTION,43 TB_EDITOR_COL_ACTION,
@@ -40,6 +46,8 @@
40 TB_EDITOR_COLS_MAX46 TB_EDITOR_COLS_MAX
41};47};
4248
49static TBEditorWindow *tbe_window=NULL;
50
43static const GtkTargetEntry tb_editor_dnd_targets[] =51static const GtkTargetEntry tb_editor_dnd_targets[] =
44{52{
45 { "MIDORI_TB_EDITOR_ROW", 0, 0 }53 { "MIDORI_TB_EDITOR_ROW", 0, 0 }
@@ -514,64 +522,81 @@
514 return tbw;522 return tbw;
515}523}
516524
525static void tb_editor_response_cb(GtkWidget* inDialog,
526 gint inResponse,
527 gpointer inUserData)
528{
529 gtk_widget_destroy(tbe_window->tbw->dialog);
530
531 g_slist_foreach(tbe_window->used_items, (GFunc) g_free, NULL);
532 g_slist_foreach(tbe_window->all_items, (GFunc) g_free, NULL);
533 g_slist_free(tbe_window->used_items);
534 g_slist_free(tbe_window->all_items);
535 tb_editor_free_path(tbe_window->tbw);
536 g_free(tbe_window->tbw);
537
538 g_free(tbe_window);
539 tbe_window=NULL;
540}
517541
518static void tb_editor_menu_configure_toolbar_activate_cb(GtkWidget *menuitem, MidoriBrowser *browser)542static void tb_editor_menu_configure_toolbar_activate_cb(GtkWidget *menuitem, MidoriBrowser *browser)
519{543{
520 GSList *node, *used_items, *all_items;544 /* create toolbar-editor window if not available */
521 GtkTreeIter iter;545 if(tbe_window==NULL)
522 GtkTreePath *path;546 {
523 TBEditorWidget *tbw;547 GSList *node;
524548 GtkTreeIter iter;
525 /* read the current active toolbar items */549 GtkTreePath *path;
526 used_items = tb_editor_parse_active_items(browser);550
527551 /* create storage for window data */
528 /* get all available actions */552 tbe_window=g_new0(TBEditorWindow, 1);
529 all_items = tb_editor_get_available_actions(browser);553
530554 /* read the current active toolbar items */
531 /* create the GUI */555 tbe_window->used_items = tb_editor_parse_active_items(browser);
532 tbw = tb_editor_create_dialog(browser);556
533557 /* get all available actions */
534 /* cache some pointers, this is safe enough since the dialog is run modally */558 tbe_window->all_items = tb_editor_get_available_actions(browser);
535 tbw->action_group = midori_browser_get_action_group(browser);559
536 tbw->browser = browser;560 /* create the GUI */
537561 tbe_window->tbw = tb_editor_create_dialog(browser);
538 /* fill the stores */562
539 for (node = all_items; node != NULL; node = node->next)563 /* cache some pointers, this is safe enough since the dialog is run modally */
540 {564 tbe_window->tbw->action_group = midori_browser_get_action_group(browser);
541 if (strcmp(node->data, "Separator") == 0 ||565 tbe_window->tbw->browser = browser;
542 g_slist_find_custom(used_items, node->data, (GCompareFunc) strcmp) == NULL)566
543 {567 /* fill the stores */
544 gtk_list_store_append(tbw->store_available, &iter);568 for (node = tbe_window->all_items; node != NULL; node = node->next)
545 tb_editor_set_item_values(tbw, node->data, tbw->store_available, &iter);569 {
546 }570 if (strcmp(node->data, "Separator") == 0 ||
547 }571 g_slist_find_custom(tbe_window->used_items, node->data, (GCompareFunc) strcmp) == NULL)
548 for (node = used_items; node != NULL; node = node->next)572 {
549 {573 gtk_list_store_append(tbe_window->tbw->store_available, &iter);
550 gtk_list_store_append(tbw->store_used, &iter);574 tb_editor_set_item_values(tbe_window->tbw, node->data, tbe_window->tbw->store_available, &iter);
551 tb_editor_set_item_values(tbw, node->data, tbw->store_used, &iter);575 }
552 }576 }
553 /* select first item */577 for (node = tbe_window->used_items; node != NULL; node = node->next)
554 path = gtk_tree_path_new_from_string("0");578 {
555 gtk_tree_selection_select_path(gtk_tree_view_get_selection(tbw->tree_used), path);579 gtk_list_store_append(tbe_window->tbw->store_used, &iter);
556 gtk_tree_path_free(path);580 tb_editor_set_item_values(tbe_window->tbw, node->data, tbe_window->tbw->store_used, &iter);
557581 }
558 /* connect the changed signals after populating the store */582 /* select first item */
559 g_signal_connect(tbw->store_used, "row-changed",583 path = gtk_tree_path_new_from_string("0");
560 G_CALLBACK(tb_editor_available_items_changed_cb), tbw);584 gtk_tree_selection_select_path(gtk_tree_view_get_selection(tbe_window->tbw->tree_used), path);
561 g_signal_connect(tbw->store_used, "row-deleted",585 gtk_tree_path_free(path);
562 G_CALLBACK(tb_editor_available_items_deleted_cb), tbw);586
563587 /* connect the changed signals after populating the store */
564 /* run it */588 g_signal_connect(tbe_window->tbw->store_used, "row-changed",
565 gtk_dialog_run(GTK_DIALOG(tbw->dialog));589 G_CALLBACK(tb_editor_available_items_changed_cb), tbe_window->tbw);
566590 g_signal_connect(tbe_window->tbw->store_used, "row-deleted",
567 gtk_widget_destroy(tbw->dialog);591 G_CALLBACK(tb_editor_available_items_deleted_cb), tbe_window->tbw);
568592
569 g_slist_foreach(used_items, (GFunc) g_free, NULL);593 /* connect signal for detecting window close */
570 g_slist_foreach(all_items, (GFunc) g_free, NULL);594 g_signal_connect(tbe_window->tbw->dialog, "response", G_CALLBACK (tb_editor_response_cb), NULL);
571 g_slist_free(used_items);595 }
572 g_slist_free(all_items);596
573 tb_editor_free_path(tbw);597 /* show dialog and make it modal */
574 g_free(tbw);598 gtk_window_set_modal(GTK_WINDOW(tbe_window->tbw->dialog), TRUE);
599 gtk_widget_show_all(tbe_window->tbw->dialog);
575}600}
576601
577static void tb_editor_browser_populate_toolbar_menu_cb(MidoriBrowser *browser, GtkWidget *menu,602static void tb_editor_browser_populate_toolbar_menu_cb(MidoriBrowser *browser, GtkWidget *menu,

Subscribers

People subscribed via source and target branches

to all changes: