Author: jannis Date: 2009-06-14 22:58:11 +0000 (Sun, 14 Jun 2009) New Revision: 30017
Modified: thunar/branches/migration-to-gio/ChangeLog thunar/branches/migration-to-gio/thunar/thunar-file.c thunar/branches/migration-to-gio/thunar/thunar-file.h Log: * thunar/thunar-file.{c,h}: Emit a ThunarFileMonitor "file-changed" signal whenever the thumbnail state of a ThunarFile is changed. This helps all components in refreshing their file information and possibly update the file icon. Modified: thunar/branches/migration-to-gio/ChangeLog =================================================================== --- thunar/branches/migration-to-gio/ChangeLog 2009-06-14 01:00:40 UTC (rev 30016) +++ thunar/branches/migration-to-gio/ChangeLog 2009-06-14 22:58:11 UTC (rev 30017) @@ -1,3 +1,10 @@ +2009-06-14 Jannis Pohlmann <jan...@xfce.org> + + * thunar/thunar-file.{c,h}: Emit a ThunarFileMonitor "file-changed" + signal whenever the thumbnail state of a ThunarFile is changed. This + helps all components in refreshing their file information and + possibly update the file icon. + 2009-06-12 Jannis Pohlmann <jan...@xfce.org> * thunar/Makefile.am, thunar/thunar-thumbnailer-manager-dbus.xml: Add Modified: thunar/branches/migration-to-gio/thunar/thunar-file.c =================================================================== --- thunar/branches/migration-to-gio/thunar/thunar-file.c 2009-06-14 01:00:40 UTC (rev 30016) +++ thunar/branches/migration-to-gio/thunar/thunar-file.c 2009-06-14 22:58:11 UTC (rev 30017) @@ -458,6 +458,8 @@ static void thunar_file_info_changed (ThunarxFileInfo *file_info) { + thunar_file_set_thumb_state (THUNAR_FILE (file_info), THUNAR_FILE_THUMB_STATE_UNKNOWN); + /* tell the file monitor that this file changed */ thunar_file_monitor_file_changed (THUNAR_FILE (file_info)); } @@ -836,7 +838,12 @@ g_free (uri); } + /* set thumb state to unknown */ + file->flags = + (file->flags & ~THUNAR_FILE_THUMB_STATE_MASK) | THUNAR_FILE_THUMB_STATE_UNKNOWN; + /* determine thumbnail path */ + /* TODO monitor the thumbnail path for changes */ uri = g_file_get_uri (file->gfile); md5_hash = g_compute_checksum_for_string (G_CHECKSUM_MD5, uri, -1); basename = g_strdup_printf ("%s.png", md5_hash); @@ -2448,6 +2455,31 @@ /** + * thunar_file_set_thumb_state: + * @file : a #ThunarFile. + * @thumb_state : the new #ThunarFileThumbState. + * + * Sets the #ThunarFileThumbState for @file to @thumb_state. + * This will cause a "file-changed" signal to be emitted from + * #ThunarFileMonitor. + **/ +void +thunar_file_set_thumb_state (ThunarFile *file, + ThunarFileThumbState state) +{ + _thunar_return_if_fail (THUNAR_IS_FILE (file)); + + /* set the new thumbnail state */ + file->flags = (file->flags & ~THUNAR_FILE_THUMB_STATE_MASK) | (state); + + /* notify others of this change, so that all components can update + * their file information */ + thunar_file_monitor_file_changed (file); +} + + + +/** * thunar_file_get_custom_icon: * @file : a #ThunarFile instance. * Modified: thunar/branches/migration-to-gio/thunar/thunar-file.h =================================================================== --- thunar/branches/migration-to-gio/thunar/thunar-file.h 2009-06-14 01:00:40 UTC (rev 30016) +++ thunar/branches/migration-to-gio/thunar/thunar-file.h 2009-06-14 22:58:11 UTC (rev 30017) @@ -217,6 +217,9 @@ const gchar *custom_icon, GError **error); +const gchar *thunar_file_get_thumbnail_path (const ThunarFile *file); +void thunar_file_set_thumb_state (ThunarFile *file, + ThunarFileThumbState state); GIcon *thunar_file_get_preview_icon (const ThunarFile *file); gchar *thunar_file_get_icon_name (const ThunarFile *file, ThunarFileIconState icon_state, @@ -249,7 +252,6 @@ GList *thunar_file_list_to_g_file_list (GList *file_list); gboolean thunar_file_is_desktop (const ThunarFile *file); -const gchar *thunar_file_get_thumbnail_path (const ThunarFile *file); /** * thunar_file_is_root: @@ -335,21 +337,6 @@ #define thunar_file_get_thumb_state(file) (THUNAR_FILE ((file))->flags & THUNAR_FILE_THUMB_STATE_MASK) /** - * thunar_file_set_thumb_state: - * @file : a #ThunarFile. - * @thumb_state : the new #ThunarFileThumbState. - * - * Sets the #ThunarFileThumbState for @file - * to @thumb_state. This method is intended - * to be used by #ThunarIconFactory only. - **/ -#define thunar_file_set_thumb_state(file, thumb_state) \ -G_STMT_START{ \ - ThunarFile *f = THUNAR_FILE ((file)); \ - f->flags = (f->flags & ~THUNAR_FILE_THUMB_STATE_MASK) | (thumb_state); \ -}G_STMT_END - -/** * thunar_file_list_copy: * @file_list : a list of #ThunarFile<!---->s. * _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits