static void view_as_changed_callback (CajaWindow *window, GtkComboBox *combo_box) { CajaWindowSlot *slot; GList *node; int index; int selected_index = -1; GtkTreeModel *model; GtkListStore *store; const CajaViewInfo *info; /* Clear the contents of ComboBox in a wacky way because there * is no function to clear all items and also no function to obtain * the number of items in a combobox. */ model = gtk_combo_box_get_model (combo_box); g_return_if_fail (GTK_IS_LIST_STORE (model)); store = GTK_LIST_STORE (model); gtk_list_store_clear (store); slot = caja_window_get_active_slot (window); /* Add a menu item for each view in the preferred list for this location. */ for (node = window->details->short_list_viewers, index = 0; node != NULL; node = node->next, ++index) { info = caja_view_factory_lookup (node->data); gtk_combo_box_append_text (combo_box, _(info->view_combo_label)); if (caja_window_slot_content_view_matches_iid (slot, (char *)node->data)) { selected_index = index; } } g_object_set_data (G_OBJECT (combo_box), "num viewers", GINT_TO_POINTER (index)); if (selected_index == -1) { const char *id; /* We're using an extra viewer, add a menu item for it */ id = caja_window_slot_get_content_view_id (slot); info = caja_view_factory_lookup (id); gtk_combo_box_append_text (combo_box, _(info->view_combo_label)); selected_index = index; } gtk_combo_box_set_active (combo_box, selected_index); }
static void action_go_to_trash_callback (GtkAction *action, gpointer user_data) { CajaWindow *window; CajaWindowSlot *slot; GFile *trash; window = CAJA_WINDOW (user_data); slot = caja_window_get_active_slot (window); trash = g_file_new_for_uri ("trash:///"); caja_window_slot_go_to (slot, trash, should_open_in_new_tab ()); g_object_unref (trash); }
static void action_go_to_network_callback (GtkAction *action, gpointer user_data) { CajaWindow *window; CajaWindowSlot *slot; GFile *network; window = CAJA_WINDOW (user_data); slot = caja_window_get_active_slot (window); network = g_file_new_for_uri (NETWORK_URI); caja_window_slot_go_to (slot, network, should_open_in_new_tab ()); g_object_unref (network); }
static void action_go_to_computer_callback (GtkAction *action, gpointer user_data) { CajaWindow *window; CajaWindowSlot *slot; GFile *computer; window = CAJA_WINDOW (user_data); slot = caja_window_get_active_slot (window); computer = g_file_new_for_uri (COMPUTER_URI); caja_window_slot_go_to (slot, computer, should_open_in_new_tab ()); g_object_unref (computer); }
static gboolean path_bar_button_released_callback (GtkWidget *widget, GdkEventButton *event, CajaNavigationWindowPane *pane) { CajaWindowSlot *slot; CajaWindowOpenFlags flags; GFile *location; int mask; gboolean handle_button_release; mask = event->state & gtk_accelerator_get_default_mod_mask (); flags = 0; handle_button_release = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget), "handle-button-release")); if (event->type == GDK_BUTTON_RELEASE && handle_button_release) { location = caja_path_bar_get_path_for_button (CAJA_PATH_BAR (pane->path_bar), widget); if (event->button == 2 && mask == 0) { flags = CAJA_WINDOW_OPEN_FLAG_NEW_TAB; } else if (event->button == 1 && mask == GDK_CONTROL_MASK) { flags = CAJA_WINDOW_OPEN_FLAG_NEW_WINDOW; } if (flags != 0) { slot = caja_window_get_active_slot (CAJA_WINDOW_PANE (pane)->window); caja_window_slot_info_open_location (slot, location, CAJA_WINDOW_OPEN_ACCORDING_TO_MODE, flags, NULL); g_object_unref (location); return TRUE; } g_object_unref (location); } return FALSE; }
static void action_connect_to_server_callback (GtkAction *action, gpointer user_data) { CajaWindow *window = CAJA_WINDOW (user_data); CajaWindowSlot *slot; GtkWidget *dialog; GFile *location; slot = caja_window_get_active_slot (window); location = caja_window_slot_get_location (slot); dialog = caja_connect_server_dialog_new (window, location); if (location) { g_object_unref (location); } gtk_widget_show (dialog); }
static void action_go_to_templates_callback (GtkAction *action, gpointer user_data) { CajaWindow *window; CajaWindowSlot *slot; char *path; GFile *location; window = CAJA_WINDOW (user_data); slot = caja_window_get_active_slot (window); path = caja_get_templates_directory (); location = g_file_new_for_path (path); g_free (path); caja_window_slot_go_to (slot, location, should_open_in_new_tab ()); g_object_unref (location); }
static void activate_bookmark_in_menu_item (GtkAction *action, gpointer user_data) { CajaWindowSlot *slot; BookmarkHolder *holder; GFile *location; holder = (BookmarkHolder *)user_data; if (caja_bookmark_uri_known_not_to_exist (holder->bookmark)) { holder->failed_callback (holder->window, holder->bookmark); } else { location = caja_bookmark_get_location (holder->bookmark); slot = caja_window_get_active_slot (holder->window); caja_window_slot_go_to (slot, location, should_open_in_new_tab ()); g_object_unref (location); } }
static gboolean path_bar_button_pressed_callback (GtkWidget *widget, GdkEventButton *event, CajaNavigationWindowPane *pane) { CajaWindowSlot *slot; CajaView *view; GFile *location; char *uri; caja_window_set_active_pane (CAJA_WINDOW_PANE (pane)->window, CAJA_WINDOW_PANE (pane)); g_object_set_data (G_OBJECT (widget), "handle-button-release", GINT_TO_POINTER (TRUE)); if (event->button == 3) { slot = caja_window_get_active_slot (CAJA_WINDOW_PANE (pane)->window); view = slot->content_view; if (view != NULL) { location = caja_path_bar_get_path_for_button ( CAJA_PATH_BAR (pane->path_bar), widget); if (location != NULL) { uri = g_file_get_uri (location); caja_view_pop_up_location_context_menu ( view, event, uri); g_object_unref (G_OBJECT (location)); g_free (uri); return TRUE; } } } return FALSE; }