Author: benny
Date: 2006-10-28 12:33:43 +0000 (Sat, 28 Oct 2006)
New Revision: 23540

Modified:
   thunar/trunk/ChangeLog
   thunar/trunk/thunar/thunar-chooser-dialog.c
   thunar/trunk/thunar/thunar-chooser-model.c
   thunar/trunk/thunar/thunar-chooser-model.h
Log:
2006-10-28      Benedikt Meurer <[EMAIL PROTECTED]>

        * thunar/thunar-chooser-model.c(thunar_chooser_model_import):
          Use preferences-desktop-default-applications for the "Recommended
          Applications" group.
        * thunar/thunar-chooser-dialog.c, thunar/thunar-chooser-model.{c,h}:
          Use the ExoCellRendererIcon to render the icons instead of preloading
          the icons in the model. Don't display the expanders with GTK+ 2.9
          and above.




Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog      2006-10-28 12:11:53 UTC (rev 23539)
+++ thunar/trunk/ChangeLog      2006-10-28 12:33:43 UTC (rev 23540)
@@ -1,5 +1,15 @@
 2006-10-28     Benedikt Meurer <[EMAIL PROTECTED]>
 
+       * thunar/thunar-chooser-model.c(thunar_chooser_model_import):
+         Use preferences-desktop-default-applications for the "Recommended
+         Applications" group.
+       * thunar/thunar-chooser-dialog.c, thunar/thunar-chooser-model.{c,h}:
+         Use the ExoCellRendererIcon to render the icons instead of preloading
+         the icons in the model. Don't display the expanders with GTK+ 2.9
+         and above.
+
+2006-10-28     Benedikt Meurer <[EMAIL PROTECTED]>
+
        * thunar-vfs/thunar-vfs-job-private.h, thunar-vfs/thunar-vfs-job.c:
          Handle file names with printf(3)-style format arguments properly
          when emitting the "info-message" signal from a job. Bug #2468.

Modified: thunar/trunk/thunar/thunar-chooser-dialog.c
===================================================================
--- thunar/trunk/thunar/thunar-chooser-dialog.c 2006-10-28 12:11:53 UTC (rev 
23539)
+++ thunar/trunk/thunar/thunar-chooser-dialog.c 2006-10-28 12:33:43 UTC (rev 
23540)
@@ -265,10 +265,10 @@
 
   /* append the tree view column */
   column = g_object_new (GTK_TYPE_TREE_VIEW_COLUMN, "expand", TRUE, NULL);
-  renderer = gtk_cell_renderer_pixbuf_new ();
+  renderer = g_object_new (EXO_TYPE_CELL_RENDERER_ICON, "follow-state", FALSE, 
"size", 24, NULL);
   gtk_tree_view_column_pack_start (column, renderer, FALSE);
   gtk_tree_view_column_set_attributes (column, renderer,
-                                       "pixbuf", 
THUNAR_CHOOSER_MODEL_COLUMN_ICON,
+                                       "icon", 
THUNAR_CHOOSER_MODEL_COLUMN_ICON,
                                        NULL);
   renderer = gtk_cell_renderer_text_new ();
   gtk_tree_view_column_pack_start (column, renderer, TRUE);
@@ -282,6 +282,14 @@
   gtk_tree_view_column_set_sort_column_id (column, 
THUNAR_CHOOSER_MODEL_COLUMN_NAME);
   gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->tree_view), column);
 
+#if GTK_CHECK_VERSION(2,9,0)
+  /* don't show the expanders with GTK+ 2.9 and above */
+  g_object_set (G_OBJECT (dialog->tree_view),
+                "level-indentation", 24,
+                "show-expanders", FALSE,
+                NULL);
+#endif
+
   /* create the "Custom command" expand */
   dialog->custom_expander = gtk_expander_new_with_mnemonic (_("Use a _custom 
command:"));
   thunar_gtk_widget_set_tooltip (dialog->custom_expander, _("Use a custom 
command for an application that is not "
@@ -980,6 +988,16 @@
       gtk_tree_path_free (path);
     }
 
+#if GTK_CHECK_VERSION(2,9,0)
+  /* expand the second tree view row (the other applications) */
+  if (G_LIKELY (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter)))
+    {
+      path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
+      gtk_tree_view_expand_to_path (GTK_TREE_VIEW (dialog->tree_view), path);
+      gtk_tree_path_free (path);
+    }
+#endif
+
   /* reset the cursor */
   if (G_LIKELY (GTK_WIDGET_REALIZED (dialog)))
     gdk_window_set_cursor (GTK_WIDGET (dialog)->window, NULL);

Modified: thunar/trunk/thunar/thunar-chooser-model.c
===================================================================
--- thunar/trunk/thunar/thunar-chooser-model.c  2006-10-28 12:11:53 UTC (rev 
23539)
+++ thunar/trunk/thunar/thunar-chooser-model.c  2006-10-28 12:33:43 UTC (rev 
23540)
@@ -171,7 +171,7 @@
   GType column_types[THUNAR_CHOOSER_MODEL_N_COLUMNS] =
   {
     G_TYPE_STRING,
-    GDK_TYPE_PIXBUF,
+    G_TYPE_STRING,
     THUNAR_VFS_TYPE_MIME_APPLICATION,
     PANGO_TYPE_STYLE,
     G_TYPE_BOOLEAN,
@@ -280,32 +280,26 @@
                              const gchar        *icon_name,
                              GList              *applications)
 {
-  ThunarIconFactory *icon_factory;
-  GtkIconTheme      *icon_theme;
-  GtkTreeIter        parent_iter;
-  GtkTreeIter        child_iter;
-  GdkPixbuf         *icon;
-  GList             *lp;
+  GtkIconTheme *icon_theme;
+  GtkTreeIter   parent_iter;
+  GtkTreeIter   child_iter;
+  GList        *lp;
 
   _thunar_return_if_fail (THUNAR_IS_CHOOSER_MODEL (model));
   _thunar_return_if_fail (title != NULL);
   _thunar_return_if_fail (icon_name != NULL);
 
-  /* query the default icon theme/factory */
+  /* query the default icon theme */
   icon_theme = gtk_icon_theme_get_default ();
-  icon_factory = thunar_icon_factory_get_for_icon_theme (icon_theme);
 
   /* insert the section title */
-  icon = gtk_icon_theme_load_icon (icon_theme, icon_name, 24, 0, NULL);
   gtk_tree_store_append (GTK_TREE_STORE (model), &parent_iter, NULL);
   gtk_tree_store_set (GTK_TREE_STORE (model), &parent_iter,
                       THUNAR_CHOOSER_MODEL_COLUMN_NAME, title,
-                      THUNAR_CHOOSER_MODEL_COLUMN_ICON, icon,
+                      THUNAR_CHOOSER_MODEL_COLUMN_ICON, icon_name,
                       THUNAR_CHOOSER_MODEL_COLUMN_WEIGHT, 
PANGO_WEIGHT_SEMIBOLD,
                       THUNAR_CHOOSER_MODEL_COLUMN_WEIGHT_SET, TRUE,
                       -1);
-  if (G_LIKELY (icon != NULL))
-    g_object_unref (G_OBJECT (icon));
 
   /* check if we have any program items */
   if (G_LIKELY (applications != NULL))
@@ -313,23 +307,13 @@
       /* insert the program items */
       for (lp = applications; lp != NULL; lp = lp->next)
         {
-          /* determine the icon name for the application */
-          icon_name = thunar_vfs_mime_handler_lookup_icon_name (lp->data, 
icon_theme);
-
-          /* try to load the themed icon for the program */
-          icon = thunar_icon_factory_load_icon (icon_factory, icon_name, 24, 
NULL, FALSE);
-
           /* append the tree row with the program data */
           gtk_tree_store_append (GTK_TREE_STORE (model), &child_iter, 
&parent_iter);
           gtk_tree_store_set (GTK_TREE_STORE (model), &child_iter,
                               THUNAR_CHOOSER_MODEL_COLUMN_NAME, 
thunar_vfs_mime_handler_get_name (lp->data),
-                              THUNAR_CHOOSER_MODEL_COLUMN_ICON, icon,
+                              THUNAR_CHOOSER_MODEL_COLUMN_ICON, 
thunar_vfs_mime_handler_lookup_icon_name (lp->data, icon_theme),
                               THUNAR_CHOOSER_MODEL_COLUMN_APPLICATION, 
lp->data,
                               -1);
-
-          /* release the icon (if any) */
-          if (G_LIKELY (icon != NULL))
-            g_object_unref (G_OBJECT (icon));
         }
     }
   else
@@ -342,9 +326,6 @@
                           THUNAR_CHOOSER_MODEL_COLUMN_STYLE_SET, TRUE,
                           -1);
     }
-
-  /* cleanup */
-  g_object_unref (G_OBJECT (icon_factory));
 }
 
 
@@ -381,7 +362,7 @@
     }
 
   /* append the "Recommended Applications:" category */
-  thunar_chooser_model_append (model, _("Recommended Applications"), 
"gnome-settings-default-applications", recommended);
+  thunar_chooser_model_append (model, _("Recommended Applications"), 
"preferences-desktop-default-applications", recommended);
 
   /* append the "Other Applications:" category */
   thunar_chooser_model_append (model, _("Other Applications"), 
"gnome-applications", other);

Modified: thunar/trunk/thunar/thunar-chooser-model.h
===================================================================
--- thunar/trunk/thunar/thunar-chooser-model.h  2006-10-28 12:11:53 UTC (rev 
23539)
+++ thunar/trunk/thunar/thunar-chooser-model.h  2006-10-28 12:33:43 UTC (rev 
23540)
@@ -37,7 +37,7 @@
 /**
  * ThunarChooserModelColumn:
  * @THUNAR_CHOOSER_MODEL_COLUMN_NAME        : the name of the application.
- * @THUNAR_CHOOSER_MODEL_COLUMN_ICON        : the icon of the application.
+ * @THUNAR_CHOOSER_MODEL_COLUMN_ICON        : the name or absolute path of the 
application's icon.
  * @THUNAR_CHOOSER_MODEL_COLUMN_APPLICATION : the #ThunarVfsMimeApplication 
object.
  * @THUNAR_CHOOSER_MODEL_COLUMN_STYLE       : custom font style.
  * @THUNAR_CHOOSER_MODEL_COLUMN_STYLE_SET   : whether to actually use the 
custom font style.

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to