static void thunar_location_entry_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { switch (prop_id) { case PROP_CURRENT_DIRECTORY: 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 (object), g_value_get_boxed (value)); break; case PROP_UI_MANAGER: thunar_component_set_ui_manager (THUNAR_COMPONENT (object), g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void thunar_location_entry_finalize (GObject *object) { /* disconnect from the selected files and the UI manager */ thunar_component_set_selected_files (THUNAR_COMPONENT (object), NULL); thunar_component_set_ui_manager (THUNAR_COMPONENT (object), NULL); /* disconnect from the current directory */ thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (object), NULL); (*G_OBJECT_CLASS (thunar_location_entry_parent_class)->finalize) (object); }
static void thunar_history_dispose (GObject *object) { ThunarHistory *history = THUNAR_HISTORY (object); /* disconnect from the current directory */ thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (history), NULL); /* disconnect from the action group */ thunar_history_set_action_group (history, NULL); (*G_OBJECT_CLASS (thunar_history_parent_class)->dispose) (object); }
static void thunar_location_bar_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { switch (prop_id) { case PROP_CURRENT_DIRECTORY: thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (object), g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void thunar_location_bar_set_current_directory (ThunarNavigator *navigator, ThunarFile *current_directory) { ThunarLocationBar *bar = THUNAR_LOCATION_BAR (navigator); GtkWidget *child; if (bar->current_directory) g_object_unref (bar->current_directory); bar->current_directory = current_directory; if (current_directory) g_object_ref (current_directory); if ((child = gtk_bin_get_child (GTK_BIN (bar))) && THUNAR_IS_NAVIGATOR (child)) thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (child), current_directory); g_object_notify (G_OBJECT (bar), "current-directory"); }
static void thunar_location_bar_finalize (GObject *object) { ThunarLocationBar *bar = THUNAR_LOCATION_BAR (object); _thunar_return_if_fail (THUNAR_IS_LOCATION_BAR (bar)); if (bar->locationEntry) g_object_unref (bar->locationEntry); if (bar->locationButtons) g_object_unref (bar->locationButtons); /* release from the current_directory */ thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (bar), NULL); (*G_OBJECT_CLASS (thunar_location_bar_parent_class)->finalize) (object); }
static GtkWidget * thunar_location_bar_install_widget (ThunarLocationBar *bar, GType type) { GtkWidget *installedWidget, *child; /* check if the the right type is already installed */ if ((child = gtk_bin_get_child (GTK_BIN (bar))) && G_TYPE_CHECK_INSTANCE_TYPE (child, type)) return child; if (type == THUNAR_TYPE_LOCATION_ENTRY) { if (bar->locationEntry == NULL) { bar->locationEntry = gtk_widget_new (THUNAR_TYPE_LOCATION_ENTRY, "current-directory", NULL, NULL); g_object_ref (bar->locationEntry); g_signal_connect_swapped (bar->locationEntry, "reload-requested", G_CALLBACK (thunar_location_bar_reload_requested), bar); g_signal_connect_swapped (bar->locationEntry, "change-directory", G_CALLBACK (thunar_navigator_change_directory), THUNAR_NAVIGATOR (bar)); g_signal_connect_swapped (bar->locationEntry, "open-new-tab", G_CALLBACK (thunar_navigator_open_new_tab), THUNAR_NAVIGATOR (bar)); } installedWidget = bar->locationEntry; } else { if (bar->locationButtons == NULL) { bar->locationButtons = gtk_widget_new (THUNAR_TYPE_LOCATION_BUTTONS, "current-directory", NULL, NULL); g_object_ref (bar->locationButtons); g_signal_connect_swapped (bar->locationButtons, "entry-requested", G_CALLBACK (thunar_location_bar_request_entry), bar); g_signal_connect_swapped (bar->locationButtons, "change-directory", G_CALLBACK (thunar_navigator_change_directory), THUNAR_NAVIGATOR (bar)); g_signal_connect_swapped (bar->locationButtons, "open-new-tab", G_CALLBACK (thunar_navigator_open_new_tab), THUNAR_NAVIGATOR (bar)); } installedWidget = bar->locationButtons; } thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (installedWidget), bar->current_directory); if ((child = gtk_bin_get_child (GTK_BIN (bar)))) gtk_container_remove (GTK_CONTAINER (bar), child); gtk_container_add (GTK_CONTAINER (bar), installedWidget); gtk_widget_show (installedWidget); return installedWidget; }
static void thunar_history_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { ThunarHistory *history = THUNAR_HISTORY (object); switch (prop_id) { case PROP_ACTION_GROUP: thunar_history_set_action_group (history, g_value_get_object (value)); break; case PROP_CURRENT_DIRECTORY: thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (history), g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }