diff --git a/ChangeLog b/ChangeLog index 0ac98026247c72a9568a88b5630d15353130349e..5d2100cca6fda93c047635b52f205cebc3802fdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-03-08 Benedikt Meurer <benny@xfce.org> + + * thunar/thunar-properties-dialog.c(thunar_properties_dialog_init): + Properly synchronize the dialog title with the name entry box. + * thunar/thunar-file.{c,h}: Add THUNAR_FILE_ICON_STATE_OPEN. + * thunar/thunar-icon-renderer.c(thunar_icon_renderer_render): Use + THUNAR_FILE_ICON_STATE_OPEN for expanded rows. + * thunar/thunar-side-pane.{c,h}, thunar/thunar-shortcuts-pane.c: Add + "show-hidden" property. + 2006-03-07 Benedikt Meurer <benny@xfce.org> * thunar-vfs/thunar-vfs-mime-legacy.c: Fix gcc4 warnings. Bug #1556. diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index 2bbb4741520fd5e40f3404d2339feb9489bdf755..59de58131fadf17de33963b88cca105cf36b6efb 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -1594,7 +1594,8 @@ thunar_file_get_icon_name (const ThunarFile *file, icon_name = thunar_vfs_mime_info_lookup_icon_name (file->info->mime_info, icon_theme); /* check if we have an accept icon for the icon we found */ - if (icon_state == THUNAR_FILE_ICON_STATE_DROP && strcmp (icon_name, "gnome-fs-directory") == 0 + if ((icon_state == THUNAR_FILE_ICON_STATE_DROP || icon_state == THUNAR_FILE_ICON_STATE_OPEN) + && strcmp (icon_name, "gnome-fs-directory") == 0 && gtk_icon_theme_has_icon (icon_theme, "gnome-fs-directory-accept")) { return "gnome-fs-directory-accept"; diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h index b26aacb7d54b707dc752288bfe7b9dfaf05256d2..5ddae5e869a4e075bdffc2c40a2a6cfb87b6e5c8 100644 --- a/thunar/thunar-file.h +++ b/thunar/thunar-file.h @@ -56,14 +56,16 @@ typedef enum * ThunarFileIconState: * @THUNAR_FILE_ICON_STATE_DEFAULT : the default icon for the file. * @THUNAR_FILE_ICON_STATE_DROP : the drop accept icon for the file. + * @THUNAR_FILE_ICON_STATE_OPEN : the folder is expanded. * * The various file icon states that are used within the file manager * views. **/ -typedef enum /*< flags >*/ +typedef enum /*< enum >*/ { THUNAR_FILE_ICON_STATE_DEFAULT, THUNAR_FILE_ICON_STATE_DROP, + THUNAR_FILE_ICON_STATE_OPEN, } ThunarFileIconState; /** diff --git a/thunar/thunar-icon-renderer.c b/thunar/thunar-icon-renderer.c index 27acb19496c1ec356874deca3ba5dcced3874f06..b69d6dd7167b073e2455d0c4512c08b7a434f097 100644 --- a/thunar/thunar-icon-renderer.c +++ b/thunar/thunar-icon-renderer.c @@ -372,7 +372,9 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer, /* determine the icon state */ icon_state = (icon_renderer->drop_file != icon_renderer->file) - ? THUNAR_FILE_ICON_STATE_DEFAULT + ? renderer->is_expanded + ? THUNAR_FILE_ICON_STATE_OPEN + : THUNAR_FILE_ICON_STATE_DEFAULT : THUNAR_FILE_ICON_STATE_DROP; /* load the main icon */ diff --git a/thunar/thunar-properties-dialog.c b/thunar/thunar-properties-dialog.c index d6fc0cd1d9701f6d089e877e53d86e5996add36c..b211b99e798bb50f2d888b6609458bac75287a80 100644 --- a/thunar/thunar-properties-dialog.c +++ b/thunar/thunar-properties-dialog.c @@ -232,6 +232,7 @@ thunar_properties_dialog_init (ThunarPropertiesDialog *dialog) gtk_widget_show (label); dialog->name_entry = g_object_new (GTK_TYPE_ENTRY, "editable", FALSE, NULL); + exo_binding_new (G_OBJECT (dialog->name_entry), "text", G_OBJECT (dialog), "title"); g_signal_connect (G_OBJECT (dialog->name_entry), "activate", G_CALLBACK (thunar_properties_dialog_activate), dialog); g_signal_connect (G_OBJECT (dialog->name_entry), "focus-out-event", G_CALLBACK (thunar_properties_dialog_focus_out_event), dialog); gtk_table_attach (GTK_TABLE (table), dialog->name_entry, 1, 2, row, row + 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); @@ -632,7 +633,6 @@ thunar_properties_dialog_update (ThunarPropertiesDialog *dialog) if (G_LIKELY (strcmp (name, gtk_entry_get_text (GTK_ENTRY (dialog->name_entry))) != 0)) { gtk_entry_set_text (GTK_ENTRY (dialog->name_entry), name); - gtk_window_set_title (GTK_WINDOW (dialog), name); /* grab the input focus to the name entry */ gtk_widget_grab_focus (dialog->name_entry); diff --git a/thunar/thunar-shortcuts-pane.c b/thunar/thunar-shortcuts-pane.c index 16ceaaa8eac94387c29454a5cb4a53220bf2c22d..d52217292acdb10b7625749ff61b33991f530299 100644 --- a/thunar/thunar-shortcuts-pane.c +++ b/thunar/thunar-shortcuts-pane.c @@ -35,6 +35,7 @@ enum PROP_0, PROP_CURRENT_DIRECTORY, PROP_SELECTED_FILES, + PROP_SHOW_HIDDEN, PROP_UI_MANAGER, }; @@ -172,6 +173,9 @@ thunar_shortcuts_pane_class_init (ThunarShortcutsPaneClass *klass) /* override ThunarComponent's properties */ g_object_class_override_property (gobject_class, PROP_SELECTED_FILES, "selected-files"); g_object_class_override_property (gobject_class, PROP_UI_MANAGER, "ui-manager"); + + /* override ThunarSidePane's properties */ + g_object_class_override_property (gobject_class, PROP_SHOW_HIDDEN, "show-hidden"); } @@ -199,6 +203,8 @@ thunar_shortcuts_pane_navigator_init (ThunarNavigatorIface *iface) static void thunar_shortcuts_pane_side_pane_init (ThunarSidePaneIface *iface) { + iface->get_show_hidden = (gpointer) exo_noop_false; + iface->set_show_hidden = (gpointer) exo_noop; } @@ -261,20 +267,22 @@ thunar_shortcuts_pane_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - ThunarShortcutsPane *shortcuts_pane = THUNAR_SHORTCUTS_PANE (object); - switch (prop_id) { case PROP_CURRENT_DIRECTORY: - g_value_set_object (value, thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (shortcuts_pane))); + g_value_set_object (value, thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (object))); break; case PROP_SELECTED_FILES: - g_value_set_boxed (value, thunar_component_get_selected_files (THUNAR_COMPONENT (shortcuts_pane))); + g_value_set_boxed (value, thunar_component_get_selected_files (THUNAR_COMPONENT (object))); + break; + + case PROP_SHOW_HIDDEN: + g_value_set_boolean (value, thunar_side_pane_get_show_hidden (THUNAR_SIDE_PANE (object))); break; case PROP_UI_MANAGER: - g_value_set_object (value, thunar_component_get_ui_manager (THUNAR_COMPONENT (shortcuts_pane))); + g_value_set_object (value, thunar_component_get_ui_manager (THUNAR_COMPONENT (object))); break; default: @@ -291,20 +299,22 @@ thunar_shortcuts_pane_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - ThunarShortcutsPane *shortcuts_pane = THUNAR_SHORTCUTS_PANE (object); - switch (prop_id) { case PROP_CURRENT_DIRECTORY: - thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (shortcuts_pane), g_value_get_object (value)); + thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (object), g_value_get_object (value)); break; case PROP_SELECTED_FILES: - thunar_component_set_selected_files (THUNAR_COMPONENT (shortcuts_pane), g_value_get_boxed (value)); + thunar_component_set_selected_files (THUNAR_COMPONENT (object), g_value_get_boxed (value)); + break; + + case PROP_SHOW_HIDDEN: + thunar_side_pane_set_show_hidden (THUNAR_SIDE_PANE (object), g_value_get_boolean (value)); break; case PROP_UI_MANAGER: - thunar_component_set_ui_manager (THUNAR_COMPONENT (shortcuts_pane), g_value_get_object (value)); + thunar_component_set_ui_manager (THUNAR_COMPONENT (object), g_value_get_object (value)); break; default: diff --git a/thunar/thunar-side-pane.c b/thunar/thunar-side-pane.c index c1da232dc4c4adf250cf2ee6eba6e4c7cc6f8755..800d35420e8a199b483e3814ba5bb72726780aee 100644 --- a/thunar/thunar-side-pane.c +++ b/thunar/thunar-side-pane.c @@ -25,6 +25,10 @@ +static void thunar_side_pane_class_init (gpointer klass); + + + GType thunar_side_pane_get_type (void) { @@ -37,7 +41,7 @@ thunar_side_pane_get_type (void) sizeof (ThunarSidePaneIface), NULL, NULL, - NULL, + (GClassInitFunc) thunar_side_pane_class_init, NULL, NULL, 0, @@ -53,3 +57,59 @@ thunar_side_pane_get_type (void) return type; } + + +static void +thunar_side_pane_class_init (gpointer klass) +{ + /** + * ThunarSidePane:show-hidden: + * + * Tells whether hidden folders will be displayed in + * the #ThunarSidePane instance. + **/ + g_object_interface_install_property (klass, + g_param_spec_boolean ("show-hidden", + "show-hidden", + "show-hidden", + FALSE, + EXO_PARAM_READWRITE)); +} + + + +/** + * thunar_side_pane_get_show_hidden: + * @side_pane : a #ThunarSidePane. + * + * Returns %TRUE if hidden folders are shown + * in the @side_pane. + * + * Return value: %TRUE if hidden folders are + * shown in the @side_pane. + **/ +gboolean +thunar_side_pane_get_show_hidden (ThunarSidePane *side_pane) +{ + g_return_val_if_fail (THUNAR_IS_SIDE_PANE (side_pane), FALSE); + return (*THUNAR_SIDE_PANE_GET_IFACE (side_pane)->get_show_hidden) (side_pane); +} + + + +/** + * thunar_side_pane_set_show_hidden: + * @side_pane : a #ThunarSidePane. + * @show_hidden : %TRUE to display hidden folders. + * + * If @show_hidden is %TRUE, hidden folders will be + * shown in the @side_pane. + **/ +void +thunar_side_pane_set_show_hidden (ThunarSidePane *side_pane, + gboolean show_hidden) +{ + g_return_if_fail (THUNAR_IS_SIDE_PANE (side_pane)); + (*THUNAR_SIDE_PANE_GET_IFACE (side_pane)->set_show_hidden) (side_pane, show_hidden); +} + diff --git a/thunar/thunar-side-pane.h b/thunar/thunar-side-pane.h index 9d594637a94a6435ec571f71345f45a2d9685d27..242779ffb0d61e70fe8fba3c2aef316a1763970c 100644 --- a/thunar/thunar-side-pane.h +++ b/thunar/thunar-side-pane.h @@ -35,9 +35,18 @@ typedef struct _ThunarSidePane ThunarSidePane; struct _ThunarSidePaneIface { GTypeInterface __parent__; + + /* virtual methods */ + gboolean (*get_show_hidden) (ThunarSidePane *side_pane); + void (*set_show_hidden) (ThunarSidePane *side_pane, + gboolean show_hidden); }; -GType thunar_side_pane_get_type (void) G_GNUC_CONST; +GType thunar_side_pane_get_type (void) G_GNUC_CONST; + +gboolean thunar_side_pane_get_show_hidden (ThunarSidePane *side_pane); +void thunar_side_pane_set_show_hidden (ThunarSidePane *side_pane, + gboolean show_hidden); G_END_DECLS;