コード例 #1
0
static void
caja_navigation_window_pane_show (CajaWindowPane *pane)
{
    CajaNavigationWindowPane *npane = CAJA_NAVIGATION_WINDOW_PANE (pane);

    gtk_widget_show (npane->widget);
}
コード例 #2
0
/* either called due to slot change, or due to location change in the current slot. */
static void
real_sync_search_widgets (CajaWindowPane *window_pane)
{
    CajaWindowSlot *slot;
    CajaDirectory *directory;
    CajaSearchDirectory *search_directory;
    CajaNavigationWindowPane *pane;

    pane = CAJA_NAVIGATION_WINDOW_PANE (window_pane);
    slot = window_pane->active_slot;
    search_directory = NULL;

    directory = caja_directory_get (slot->location);
    if (CAJA_IS_SEARCH_DIRECTORY (directory))
    {
        search_directory = CAJA_SEARCH_DIRECTORY (directory);
    }

    if (search_directory != NULL &&
            !caja_search_directory_is_saved_search (search_directory))
    {
        caja_navigation_window_pane_show_location_bar_temporarily (pane);
        caja_navigation_window_pane_set_bar_mode (pane, CAJA_BAR_SEARCH);
        pane->temporary_search_bar = FALSE;
    }
    else
    {
        pane->temporary_search_bar = TRUE;
        caja_navigation_window_pane_hide_temporary_bars (pane);
    }
    caja_directory_unref (directory);
}
コード例 #3
0
static void
real_sync_location_widgets (CajaWindowPane *pane)
{
    CajaNavigationWindowSlot *navigation_slot;
    CajaNavigationWindowPane *navigation_pane;
    CajaWindowSlot *slot;

    slot = pane->active_slot;
    navigation_pane = CAJA_NAVIGATION_WINDOW_PANE (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 = caja_window_slot_get_location_uri (slot);
        caja_location_bar_set_location (CAJA_LOCATION_BAR (navigation_pane->navigation_bar), uri);
        g_free (uri);
        caja_path_bar_set_path (CAJA_PATH_BAR (navigation_pane->path_bar), slot->location);
    }

    /* Update window global UI if this is the active pane */
    if (pane == pane->window->details->active_pane)
    {
        caja_window_update_up_button (pane->window);

        /* Check if the back and forward buttons need enabling or disabling. */
        navigation_slot = CAJA_NAVIGATION_WINDOW_SLOT (pane->window->details->active_pane->active_slot);
        caja_navigation_window_allow_back (CAJA_NAVIGATION_WINDOW (pane->window),
                                           navigation_slot->back_list != NULL);
        caja_navigation_window_allow_forward (CAJA_NAVIGATION_WINDOW (pane->window),
                                              navigation_slot->forward_list != NULL);
    }
}
コード例 #4
0
static gboolean
notebook_button_press_cb (GtkWidget *widget,
                          GdkEventButton *event,
                          gpointer user_data)
{
    CajaNavigationWindowPane *pane;

    pane = CAJA_NAVIGATION_WINDOW_PANE (user_data);
    if (GDK_BUTTON_PRESS == event->type && 3 == event->button)
    {
        notebook_popup_menu_show (pane, event);
        return TRUE;
    }
    else if (GDK_BUTTON_PRESS == event->type && 2 == event->button)
    {
        CajaWindowPane *wpane;
        CajaWindowSlot *slot;

        wpane = CAJA_WINDOW_PANE (pane);
        slot = wpane->active_slot;
        caja_window_slot_close (slot);

        return FALSE;
    }

    return FALSE;
}
コード例 #5
0
static void
notebook_popup_menu_move_right_cb (GtkMenuItem *menuitem,
                                   gpointer user_data)
{
    CajaNavigationWindowPane *pane;

    pane = CAJA_NAVIGATION_WINDOW_PANE (user_data);
    caja_notebook_reorder_current_child_relative (CAJA_NOTEBOOK (pane->notebook), 1);
}
コード例 #6
0
static gboolean
notebook_popup_menu_cb (GtkWidget *widget,
                        gpointer user_data)
{
    CajaNavigationWindowPane *pane;

    pane = CAJA_NAVIGATION_WINDOW_PANE (user_data);
    notebook_popup_menu_show (pane, NULL);
    return TRUE;
}
コード例 #7
0
static void
real_close_slot (CajaWindowPane *pane,
                 CajaWindowSlot *slot)
{
    int page_num;
    GtkNotebook *notebook;

    notebook = GTK_NOTEBOOK (CAJA_NAVIGATION_WINDOW_PANE (pane)->notebook);

    page_num = gtk_notebook_page_num (notebook, slot->content_box);
    g_assert (page_num >= 0);

    caja_navigation_window_pane_remove_page (CAJA_NAVIGATION_WINDOW_PANE (pane), page_num);

    gtk_notebook_set_show_tabs (notebook,
                                gtk_notebook_get_n_pages (notebook) > 1);

    EEL_CALL_PARENT (CAJA_WINDOW_CLASS,
                     close_slot, (pane, slot));
}
コード例 #8
0
void
caja_navigation_window_hide_search (CajaNavigationWindow *window)
{
    CajaNavigationWindowPane *pane = CAJA_NAVIGATION_WINDOW_PANE (CAJA_WINDOW (window)->details->active_pane);
    if (caja_navigation_window_pane_search_bar_showing (pane))
    {
        if (caja_navigation_window_pane_hide_temporary_bars (pane))
        {
            caja_navigation_window_restore_focus_widget (window);
        }
    }
}
コード例 #9
0
static void
real_sync_allow_stop (CajaWindow *window,
                      CajaWindowSlot *slot)
{
    CajaNavigationWindow *navigation_window;
    CajaNotebook *notebook;

    navigation_window = CAJA_NAVIGATION_WINDOW (window);
    caja_navigation_window_set_spinner_active (navigation_window, slot->allow_stop);

    notebook = CAJA_NOTEBOOK (CAJA_NAVIGATION_WINDOW_PANE (slot->pane)->notebook);
    caja_notebook_sync_loading (notebook, slot);
}
コード例 #10
0
static CajaWindowSlot *
real_open_slot (CajaWindowPane *pane,
                CajaWindowOpenSlotFlags flags)
{
    CajaWindowSlot *slot;

    slot = (CajaWindowSlot *) g_object_new (CAJA_TYPE_NAVIGATION_WINDOW_SLOT, NULL);
    slot->pane = pane;

    caja_navigation_window_pane_add_slot_in_tab (CAJA_NAVIGATION_WINDOW_PANE (pane), slot, flags);
    gtk_widget_show (slot->content_box);

    return slot;
}
コード例 #11
0
void
caja_navigation_window_show_search (CajaNavigationWindow *window)
{
    CajaNavigationWindowPane *pane;

    pane = CAJA_NAVIGATION_WINDOW_PANE (CAJA_WINDOW (window)->details->active_pane);
    if (!caja_navigation_window_pane_search_bar_showing (pane))
    {
        remember_focus_widget (window);

        caja_navigation_window_pane_show_location_bar_temporarily (pane);
        caja_navigation_window_pane_set_bar_mode (pane, CAJA_BAR_SEARCH);
        pane->temporary_search_bar = TRUE;
        caja_search_bar_clear (CAJA_SEARCH_BAR (pane->search_bar));
    }

    caja_search_bar_grab_focus (CAJA_SEARCH_BAR (pane->search_bar));
}
コード例 #12
0
static void
real_prompt_for_location (CajaWindow *window, const char *initial)
{
    CajaNavigationWindowPane *pane;

    remember_focus_widget (CAJA_NAVIGATION_WINDOW (window));

    pane = CAJA_NAVIGATION_WINDOW_PANE (window->details->active_pane);

    caja_navigation_window_pane_show_location_bar_temporarily (pane);
    caja_navigation_window_pane_show_navigation_bar_temporarily (pane);

    if (initial)
    {
        caja_navigation_bar_set_location (CAJA_NAVIGATION_BAR (pane->navigation_bar),
                                          initial);
    }
}
コード例 #13
0
static void
real_set_active (CajaWindowPane *pane, gboolean is_active)
{
    CajaNavigationWindowPane *nav_pane;
    GList *l;

    nav_pane = CAJA_NAVIGATION_WINDOW_PANE (pane);

    /* path bar */
    for (l = CAJA_PATH_BAR (nav_pane->path_bar)->button_list; l; l = l->next)
    {
        gtk_widget_set_sensitive (gtk_bin_get_child (GTK_BIN (caja_path_bar_get_button_from_button_list_entry (l->data))), is_active);
    }

    /* navigation bar (manual entry) */
    caja_location_bar_set_active (CAJA_LOCATION_BAR (nav_pane->navigation_bar), is_active);
    
    /* location button */
    gtk_widget_set_sensitive (gtk_bin_get_child (GTK_BIN (nav_pane->location_button)), is_active);
}
コード例 #14
0
ファイル: caja-notebook.c プロジェクト: Exalm/caja
/* FIXME remove when gtknotebook's func for this becomes public, bug #.... */
static CajaNotebook *
find_notebook_at_pointer (gint abs_x, gint abs_y)
{
#if GTK_CHECK_VERSION(3, 0, 0)
    GdkDeviceManager *manager;
    GdkDevice *pointer;
#endif
    GdkWindow *win_at_pointer, *toplevel_win;
    gpointer toplevel = NULL;
    gint x, y;

    /* FIXME multi-head */
#if GTK_CHECK_VERSION(3, 0, 0)
    manager = gdk_display_get_device_manager (gdk_display_get_default ());
    pointer = gdk_device_manager_get_client_pointer (manager);
    win_at_pointer = gdk_device_get_window_at_position (pointer, &x, &y);
#else
    win_at_pointer = gdk_window_at_pointer (&x, &y);
#endif

    if (win_at_pointer == NULL)
    {
        /* We are outside all windows containing a notebook */
        return NULL;
    }

    toplevel_win = gdk_window_get_toplevel (win_at_pointer);

    /* get the GtkWidget which owns the toplevel GdkWindow */
    gdk_window_get_user_data (toplevel_win, &toplevel);

    /* toplevel should be an CajaWindow */
    if (toplevel != NULL && CAJA_IS_NAVIGATION_WINDOW (toplevel))
    {
        return CAJA_NOTEBOOK (CAJA_NAVIGATION_WINDOW_PANE (CAJA_WINDOW (toplevel)->details->active_pane)->notebook);
    }

    return NULL;
}
コード例 #15
0
static void
real_sync_title (CajaWindow *window,
                 CajaWindowSlot *slot)
{
    CajaNavigationWindowPane *pane;
    CajaNotebook *notebook;
    char *full_title;
    char *window_title;

    EEL_CALL_PARENT (CAJA_WINDOW_CLASS,
                     sync_title, (window, slot));

    if (slot == window->details->active_pane->active_slot)
    {
        /* if spatial mode is default, we keep "File Browser" in the window title
         * to recognize browser windows. Otherwise, we default to the directory name.
         */
        if (!g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER))
        {
            full_title = g_strdup_printf (_("%s - File Browser"), slot->title);
            window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH);
            g_free (full_title);
        }
        else
        {
            window_title = eel_str_middle_truncate (slot->title, MAX_TITLE_LENGTH);
        }

        gtk_window_set_title (GTK_WINDOW (window), window_title);
        g_free (window_title);
    }

    pane = CAJA_NAVIGATION_WINDOW_PANE (slot->pane);
    notebook = CAJA_NOTEBOOK (pane->notebook);
    caja_notebook_sync_tab_label (notebook, slot);
}