1. jjacky
  2. kalu

Commits

jjacky  committed 6ba3d6f

column sort order: added option SaneSortOrder (though it's not featured in Preferences)

  • Participants
  • Parent commits 21f7169
  • Branches default

Comments (0)

Files changed (4)

File config.c

View file
  • Ignore whitespace
                         debug ("config: checks_manual: %d", checks);
                     }
                 }
+                else if (strcmp (key, "SaneSortOrder") == 0)
+                {
+                    if (*value == '1')
+                    {
+                        config->sane_sort_order = TRUE;
+                    }
+                    debug ("config: sane sort order: %d", config->sane_sort_order);
+                }
                 else
                 {
                     set_error ("unknown option: %s", key);

File kalu.h

View file
  • Ignore whitespace
     char            *cmdline;
     char            *cmdline_aur;
     alpm_list_t     *cmdline_post;
+    gboolean         sane_sort_order;
     
     templates_t     *tpl_upgrades;
     templates_t     *tpl_watched;

File preferences.c

View file
  • Ignore whitespace
     new_config.tpl_news         = calloc (1, sizeof (templates_t));
     new_config.aur_ignore       = NULL;
     
+    /* this is a "tweak" not featured as GUI */
+    new_config.sane_sort_order = config->sane_sort_order;
+    add_to_conf ("SaneSortOrder = %d\n", new_config.sane_sort_order);
+    
     /* General */
     s = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooser));
     if (NULL == s)

File updater.c

View file
  • Ignore whitespace
                                                        NULL);
     gtk_tree_view_column_set_resizable (column, TRUE);
     gtk_tree_view_column_set_sort_column_id (column, UCOL_PACKAGE);
-    g_signal_connect (G_OBJECT (column), "clicked",
-                      G_CALLBACK (column_clicked_cb), NULL);
+    if (config->sane_sort_order)
+    {
+        g_signal_connect (G_OBJECT (column), "clicked",
+                          G_CALLBACK (column_clicked_cb), NULL);
+    }
     gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
     /* column: Old version */
     column = gtk_tree_view_column_new_with_attributes ("Old/Current",
                                                        NULL);
     gtk_tree_view_column_set_resizable (column, TRUE);
     gtk_tree_view_column_set_sort_column_id (column, UCOL_OLD);
-    g_signal_connect (G_OBJECT (column), "clicked",
-                      G_CALLBACK (column_clicked_cb), NULL);
+    if (config->sane_sort_order)
+    {
+        g_signal_connect (G_OBJECT (column), "clicked",
+                          G_CALLBACK (column_clicked_cb), NULL);
+    }
     gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
     /* column: New version */
     column = gtk_tree_view_column_new_with_attributes ("New",
                                                        NULL);
     gtk_tree_view_column_set_resizable (column, TRUE);
     gtk_tree_view_column_set_sort_column_id (column, UCOL_NEW);
-    g_signal_connect (G_OBJECT (column), "clicked",
-                      G_CALLBACK (column_clicked_cb), NULL);
+    if (config->sane_sort_order)
+    {
+        g_signal_connect (G_OBJECT (column), "clicked",
+                          G_CALLBACK (column_clicked_cb), NULL);
+    }
     gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
     /* column: Download size */
     renderer_lbl = gtk_cell_renderer_text_new ();
     gtk_tree_view_column_pack_start (column, renderer_pbar, TRUE);
     gtk_tree_view_column_set_resizable (column, TRUE);
     gtk_tree_view_column_set_sort_column_id (column, UCOL_DL_SIZE);
-    g_signal_connect (G_OBJECT (column), "clicked",
-                      G_CALLBACK (column_clicked_cb), NULL);
+    if (config->sane_sort_order)
+    {
+        g_signal_connect (G_OBJECT (column), "clicked",
+                          G_CALLBACK (column_clicked_cb), NULL);
+    }
     gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
     /* column: Installed size */
     renderer_lbl = gtk_cell_renderer_text_new ();
     gtk_tree_view_column_pack_start (column, renderer_pbar, TRUE);
     gtk_tree_view_column_set_resizable (column, TRUE);
     gtk_tree_view_column_set_sort_column_id (column, UCOL_NEW_SIZE);
-    g_signal_connect (G_OBJECT (column), "clicked",
-                      G_CALLBACK (column_clicked_cb), NULL);
+    if (config->sane_sort_order)
+    {
+        g_signal_connect (G_OBJECT (column), "clicked",
+                          G_CALLBACK (column_clicked_cb), NULL);
+    }
     gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
     /* column: Net size */
     column = gtk_tree_view_column_new_with_attributes ("Net",
         (GtkTreeCellDataFunc) rend_net_size, NULL, NULL);
     gtk_tree_view_column_set_resizable (column, TRUE);
     gtk_tree_view_column_set_sort_column_id (column, UCOL_NET_SIZE);
-    g_signal_connect (G_OBJECT (column), "clicked",
-                      G_CALLBACK (column_clicked_cb), NULL);
+    if (config->sane_sort_order)
+    {
+        g_signal_connect (G_OBJECT (column), "clicked",
+                          G_CALLBACK (column_clicked_cb), NULL);
+    }
     gtk_tree_view_append_column (GTK_TREE_VIEW (list), column);
     
     /* set the tree ordered by package ASC */
     gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
                                           UCOL_PACKAGE,
                                           GTK_SORT_ASCENDING);
-    /* reverse the initial arrow */
-    column = gtk_tree_view_get_column (GTK_TREE_VIEW (list), 0);
-    gtk_tree_view_column_set_sort_order (column, GTK_SORT_DESCENDING);
+    if (config->sane_sort_order)
+    {
+        /* reverse the initial arrow */
+        column = gtk_tree_view_get_column (GTK_TREE_VIEW (list), 0);
+        gtk_tree_view_column_set_sort_order (column, GTK_SORT_DESCENDING);
+    }
     
     gtk_container_add (GTK_CONTAINER (scrolled_window), list);
     gtk_widget_show (list);