fix bug 4239, 'Preferences: Text Options Header Display modal is not modal' (sic)
[claws.git] / src / prefs_summary_column.c
index 39b6f80ba2f6441ff4ec4943e9e57d6d935587a8..11ac67df5190dfa0c2db6ec19b4c09d636b820d7 100644 (file)
@@ -221,6 +221,7 @@ static void prefs_summary_column_create(void)
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
        gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
+       gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
        gtk_window_set_title(GTK_WINDOW(window),
                             _("Message list columns configuration"));
        g_signal_connect(G_OBJECT(window), "delete_event",
@@ -825,48 +826,48 @@ static void drag_data_received(GtkTreeView *tree_view, GdkDragContext *context,
        SummaryColumnType type;
        GtkTreeModel *sel_model;
        gchar *name;
-       
+
        source = gtk_drag_get_source_widget(context);
-       
+
        if (source == GTK_WIDGET(tree_view)) {
        
                /*
                 * Same widget: re-order
                 */
-                
-               gtk_tree_selection_get_selected(gtk_tree_view_get_selection(tree_view),
-                                          NULL, &isel);
-               sel = gtk_tree_model_get_path(model, &isel);
-               gtk_tree_view_get_dest_row_at_pos(tree_view, x, y,
-                                                 &dst, &pos);
-
-               /* NOTE: dst is invalid if selection beyond last row, in that
-                * case move beyond last one (XXX_move_before(..., NULL)) */                                              
-
-               if (dst)                                                  
-                       gtk_tree_model_get_iter(model, &idst, dst);
-               else 
-                       gtk_list_store_move_before(GTK_LIST_STORE(model),
-                                                  &isel,
-                                                  NULL);
-
-               /* we do not drag if no valid dst and sel, and when
-                * dst and sel are the same (moving after or before
-                * itself doesn't change order...) */
-               if ((dst && sel) && gtk_tree_path_compare(sel, dst) != 0) {
-                       if (pos == GTK_TREE_VIEW_DROP_BEFORE
-                       ||  pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+
+               if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(tree_view),
+                                          NULL, &isel)) {
+                       sel = gtk_tree_model_get_path(model, &isel);
+                       gtk_tree_view_get_dest_row_at_pos(tree_view, x, y,
+                                                         &dst, &pos);
+
+                       /* NOTE: dst is invalid if selection beyond last row, in that
+                        * case move beyond last one (XXX_move_before(..., NULL)) */
+
+                       if (dst)
+                               gtk_tree_model_get_iter(model, &idst, dst);
+                       else 
                                gtk_list_store_move_before(GTK_LIST_STORE(model),
                                                           &isel,
-                                                          &idst);
-                       else
-                               gtk_list_store_move_after(GTK_LIST_STORE(model),
-                                                         &isel,
-                                                         &idst);
-                       
-               } 
-               gtk_tree_path_free(dst);                                          
-               gtk_tree_path_free(sel);
+                                                          NULL);
+
+                       /* we do not drag if no valid dst and sel, and when
+                        * dst and sel are the same (moving after or before
+                        * itself doesn't change order...) */
+                       if ((dst && sel) && gtk_tree_path_compare(sel, dst) != 0) {
+                               if (pos == GTK_TREE_VIEW_DROP_BEFORE
+                               ||  pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+                                       gtk_list_store_move_before(GTK_LIST_STORE(model),
+                                                                  &isel,
+                                                                  &idst);
+                               else
+                                       gtk_list_store_move_after(GTK_LIST_STORE(model),
+                                                                 &isel,
+                                                                 &idst);
+                       } 
+                       gtk_tree_path_free(dst);
+                       gtk_tree_path_free(sel);
+               }
                gtk_drag_finish(context, TRUE, FALSE, time);
                
        } else if (source == summary_col.stock_list_view 
@@ -876,41 +877,41 @@ static void drag_data_received(GtkTreeView *tree_view, GdkDragContext *context,
                 * Other widget: change and update
                 */
 
-               
                /* get source information and remove */
-               gtk_tree_selection_get_selected(gtk_tree_view_get_selection(
+               if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(
                                                GTK_TREE_VIEW(source)),
-                                               &sel_model, &isel);
-               type = *((gint *) gtk_selection_data_get_data(data));
-               name = gettext(col_name[type]);
-               gtk_list_store_remove(GTK_LIST_STORE(sel_model), &isel);
-
-               /* get insertion position */
-               gtk_tree_view_get_dest_row_at_pos(tree_view, x, y, &dst, &pos);
-
-               /* NOTE: dst is invalid if insertion point beyond last row, 
-                * just append to list in that case (XXX_store_append()) */
-
-               if (dst) {
-                       gtk_tree_model_get_iter(model, &idst, dst);
-
-                       if (pos == GTK_TREE_VIEW_DROP_BEFORE
-                       ||  pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
-                               gtk_list_store_insert_before(GTK_LIST_STORE(model),
-                                                            &isel,
-                                                            &idst);
-                       else
-                               gtk_list_store_insert_after(GTK_LIST_STORE(model),
-                                                           &isel,
-                                                           &idst);
-               } else
-                       gtk_list_store_append(GTK_LIST_STORE(model),
-                                             &isel);
-               
-               gtk_list_store_set(GTK_LIST_STORE(model), &isel,
-                                  SUMCOL_NAME, name,
-                                  SUMCOL_TYPE, type, -1);
-               gtk_tree_path_free(dst);
+                                               &sel_model, &isel)) {
+                       type = *((gint *) gtk_selection_data_get_data(data));
+                       name = gettext(col_name[type]);
+                       gtk_list_store_remove(GTK_LIST_STORE(sel_model), &isel);
+
+                       /* get insertion position */
+                       gtk_tree_view_get_dest_row_at_pos(tree_view, x, y, &dst, &pos);
+
+                       /* NOTE: dst is invalid if insertion point beyond last row, 
+                        * just append to list in that case (XXX_store_append()) */
+
+                       if (dst) {
+                               gtk_tree_model_get_iter(model, &idst, dst);
+
+                               if (pos == GTK_TREE_VIEW_DROP_BEFORE
+                               ||  pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+                                       gtk_list_store_insert_before(GTK_LIST_STORE(model),
+                                                                    &isel,
+                                                                    &idst);
+                               else
+                                       gtk_list_store_insert_after(GTK_LIST_STORE(model),
+                                                                   &isel,
+                                                                   &idst);
+                       } else
+                               gtk_list_store_append(GTK_LIST_STORE(model),
+                                                     &isel);
+
+                       gtk_list_store_set(GTK_LIST_STORE(model), &isel,
+                                          SUMCOL_NAME, name,
+                                          SUMCOL_TYPE, type, -1);
+                       gtk_tree_path_free(dst);
+               }
                gtk_drag_finish(context, TRUE, FALSE, time);
        }