static void editable_activate_callback (GtkEntry *entry, gpointer user_data) { nemo_location_bar_update_icon (NEMO_LOCATION_BAR (user_data)); NemoLocationBar *self = user_data; const char *entry_text; entry_text = gtk_entry_get_text (entry); if (entry_text != NULL && *entry_text != '\0') { emit_location_changed (self); } }
static void finalize (GObject *object) { NemoLocationBar *bar; bar = NEMO_LOCATION_BAR (object); /* cancel the pending idle call, if any */ if (bar->details->idle_id != 0) { g_source_remove (bar->details->idle_id); bar->details->idle_id = 0; } g_free (bar->details->last_location); bar->details->last_location = NULL; G_OBJECT_CLASS (nemo_location_bar_parent_class)->finalize (object); }
void nemo_window_pane_ensure_location_bar (NemoWindowPane *pane) { gboolean show_location, use_temp_toolbars; use_temp_toolbars = !g_settings_get_boolean (nemo_window_state, NEMO_WINDOW_STATE_START_WITH_TOOLBAR); show_location = nemo_toolbar_get_show_location_entry (NEMO_TOOLBAR (pane->tool_bar)); if (use_temp_toolbars) { if (!pane->temporary_navigation_bar) { gtk_widget_show (pane->tool_bar); pane->temporary_navigation_bar = TRUE; } } if (show_location) { remember_focus_widget (pane); nemo_location_bar_activate (NEMO_LOCATION_BAR (pane->location_bar)); } else { restore_focus_widget (pane); } }
void nemo_window_pane_sync_location_widgets (NemoWindowPane *pane) { NemoWindowSlot *slot, *active_slot; NemoNavigationState *nav_state; gchar *view_id; slot = pane->active_slot; nemo_window_pane_hide_temporary_bars (pane); /* Change the location bar and path bar to match the current location. */ if (slot->location != NULL) { char *uri; /* this may be NULL if we just created the slot */ uri = nemo_window_slot_get_location_uri (slot); nemo_location_bar_set_location (NEMO_LOCATION_BAR (pane->location_bar), uri); g_free (uri); nemo_path_bar_set_path (NEMO_PATH_BAR (pane->path_bar), slot->location); restore_focus_widget (pane); } /* Update window global UI if this is the active pane */ if (pane == nemo_window_get_active_pane (pane->window)) { nemo_window_sync_up_button (pane->window); /* Check if the back and forward buttons need enabling or disabling. */ active_slot = nemo_window_get_active_slot (pane->window); nav_state = nemo_window_get_navigation_state (pane->window); nemo_navigation_state_set_boolean (nav_state, NEMO_ACTION_BACK, active_slot->back_list != NULL); nemo_navigation_state_set_boolean (nav_state, NEMO_ACTION_FORWARD, active_slot->forward_list != NULL); } }
static void editable_changed_callback (GtkEntry *entry, gpointer user_data) { nemo_location_bar_update_icon (NEMO_LOCATION_BAR (user_data)); }
static void drag_data_received_callback (GtkWidget *widget, GdkDragContext *context, int x, int y, GtkSelectionData *data, guint info, guint32 time, gpointer callback_data) { char **names; NemoApplication *application; int name_count; NemoWindow *new_window, *window; GdkScreen *screen; gboolean new_windows_for_extras; char *prompt; char *detail; GFile *location; NemoLocationBar *self = NEMO_LOCATION_BAR (widget); g_assert (data != NULL); g_assert (callback_data == NULL); names = g_uri_list_extract_uris ((const gchar *) gtk_selection_data_get_data (data)); if (names == NULL || *names == NULL) { g_warning ("No D&D URI's"); g_strfreev (names); gtk_drag_finish (context, FALSE, FALSE, time); return; } window = nemo_location_bar_get_window (widget); new_windows_for_extras = FALSE; /* Ask user if they really want to open multiple windows * for multiple dropped URIs. This is likely to have been * a mistake. */ name_count = g_strv_length (names); if (name_count > 1) { prompt = g_strdup_printf (ngettext("Do you want to view %d location?", "Do you want to view %d locations?", name_count), name_count); detail = g_strdup_printf (ngettext("This will open %d separate window.", "This will open %d separate windows.", name_count), name_count); /* eel_run_simple_dialog should really take in pairs * like gtk_dialog_new_with_buttons() does. */ new_windows_for_extras = eel_run_simple_dialog (GTK_WIDGET (window), TRUE, GTK_MESSAGE_QUESTION, prompt, detail, GTK_STOCK_CANCEL, GTK_STOCK_OK, NULL) != 0 /* GNOME_OK */; g_free (prompt); g_free (detail); if (!new_windows_for_extras) { g_strfreev (names); gtk_drag_finish (context, FALSE, FALSE, time); return; } } nemo_location_bar_set_location (self, names[0]); emit_location_changed (self); if (new_windows_for_extras) { int i; application = nemo_application_get_singleton (); screen = gtk_window_get_screen (GTK_WINDOW (window)); for (i = 1; names[i] != NULL; ++i) { new_window = nemo_application_create_window (application, screen); location = g_file_new_for_uri (names[i]); nemo_window_go_to (new_window, location); g_object_unref (location); } } g_strfreev (names); gtk_drag_finish (context, TRUE, FALSE, time); }
static void nemo_window_pane_constructed (GObject *obj) { NemoWindowPane *pane = NEMO_WINDOW_PANE (obj); GtkSizeGroup *header_size_group; NemoWindow *window; GtkActionGroup *action_group; G_OBJECT_CLASS (nemo_window_pane_parent_class)->constructed (obj); window = pane->window; header_size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); gtk_size_group_set_ignore_hidden (header_size_group, FALSE); /* build the toolbar */ action_group = nemo_window_create_toolbar_action_group (window); pane->toolbar_action_group = action_group; pane->tool_bar = GTK_WIDGET (nemo_toolbar_new (action_group)); g_signal_connect_object (pane->tool_bar, "notify::show-location-entry", G_CALLBACK (location_entry_changed_cb), pane, 0); pane->action_group = action_group; setup_search_action (pane); g_signal_connect (pane->action_group, "pre-activate", G_CALLBACK (toolbar_action_group_activated_callback), pane); /* Pack to windows hbox (under the menu */ gtk_box_pack_start (GTK_BOX (window->details->toolbar_holder), pane->tool_bar, TRUE, TRUE, 0); /* start as non-active */ nemo_window_pane_set_active (pane, FALSE); g_settings_bind_with_mapping (nemo_window_state, NEMO_WINDOW_STATE_START_WITH_TOOLBAR, pane->tool_bar, "visible", G_SETTINGS_BIND_GET, nemo_window_disable_chrome_mapping, NULL, window, NULL); /* connect to the pathbar signals */ pane->path_bar = nemo_toolbar_get_path_bar (NEMO_TOOLBAR (pane->tool_bar)); gtk_size_group_add_widget (header_size_group, pane->path_bar); g_signal_connect_object (pane->path_bar, "path-clicked", G_CALLBACK (path_bar_location_changed_callback), pane, 0); g_signal_connect_object (pane->path_bar, "path-set", G_CALLBACK (path_bar_path_set_callback), pane, 0); /* connect to the location bar signals */ pane->location_bar = nemo_toolbar_get_location_bar (NEMO_TOOLBAR (pane->tool_bar)); gtk_size_group_add_widget (header_size_group, pane->location_bar); nemo_clipboard_set_up_editable (GTK_EDITABLE (nemo_location_bar_get_entry (NEMO_LOCATION_BAR (pane->location_bar))), nemo_window_get_ui_manager (NEMO_WINDOW (window)), TRUE); g_signal_connect_object (pane->location_bar, "location-changed", G_CALLBACK (navigation_bar_location_changed_callback), pane, 0); g_signal_connect_object (pane->location_bar, "cancel", G_CALLBACK (navigation_bar_cancel_callback), pane, 0); g_signal_connect_object (nemo_location_bar_get_entry (NEMO_LOCATION_BAR (pane->location_bar)), "focus-in-event", G_CALLBACK (toolbar_focus_in_callback), pane, 0); /* connect to the search bar signals */ pane->search_bar = nemo_toolbar_get_search_bar (NEMO_TOOLBAR (pane->tool_bar)); gtk_size_group_add_widget (header_size_group, pane->search_bar); g_signal_connect_object (pane->search_bar, "activate", G_CALLBACK (search_bar_activate_callback), pane, 0); g_signal_connect_object (pane->search_bar, "cancel", G_CALLBACK (search_bar_cancel_callback), pane, 0); g_signal_connect_object (nemo_search_bar_get_entry (NEMO_SEARCH_BAR (pane->search_bar)), "focus-in-event", G_CALLBACK (toolbar_focus_in_callback), pane, 0); /* initialize the notebook */ pane->notebook = g_object_new (NEMO_TYPE_NOTEBOOK, NULL); gtk_box_pack_start (GTK_BOX (pane), pane->notebook, TRUE, TRUE, 0); g_signal_connect (pane->notebook, "tab-close-request", G_CALLBACK (notebook_tab_close_requested), pane); g_signal_connect_after (pane->notebook, "button_press_event", G_CALLBACK (notebook_button_press_cb), pane); g_signal_connect (pane->notebook, "popup-menu", G_CALLBACK (notebook_popup_menu_cb), pane); g_signal_connect (pane->notebook, "switch-page", G_CALLBACK (notebook_switch_page_cb), pane); g_signal_connect (pane->notebook, "create-window", G_CALLBACK (notebook_create_window_cb), pane); g_signal_connect (pane->notebook, "page-added", G_CALLBACK (notebook_page_added_cb), pane); g_signal_connect (pane->notebook, "page-removed", G_CALLBACK (notebook_page_removed_cb), pane); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (pane->notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (pane->notebook), FALSE); gtk_notebook_set_group_name (GTK_NOTEBOOK (pane->notebook), "nemo-slots"); gtk_widget_show (pane->notebook); gtk_container_set_border_width (GTK_CONTAINER (pane->notebook), 0); /* Ensure that the view has some minimal size and that other parts * of the UI (like location bar and tabs) don't request more and * thus affect the default position of the split view paned. */ gtk_widget_set_size_request (GTK_WIDGET (pane), 60, 60); /* * If we're on the desktop we need to make sure the toolbar can never show */ if (NEMO_IS_DESKTOP_WINDOW(window)) { gtk_widget_hide (GTK_WIDGET (window->details->toolbar_holder)); } /* we can unref the size group now */ g_object_unref (header_size_group); }