Exemple #1
0
void
caja_notebook_sync_tab_label (CajaNotebook *notebook,
                              CajaWindowSlot *slot)
{
    GtkWidget *hbox, *label;
    char *location_name;

    g_return_if_fail (CAJA_IS_NOTEBOOK (notebook));
    g_return_if_fail (CAJA_IS_WINDOW_SLOT (slot));
    g_return_if_fail (GTK_IS_WIDGET (slot->content_box));

    hbox = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook), slot->content_box);
    g_return_if_fail (GTK_IS_WIDGET (hbox));

    label = GTK_WIDGET (g_object_get_data (G_OBJECT (hbox), "label"));
    g_return_if_fail (GTK_IS_WIDGET (label));

    gtk_label_set_text (GTK_LABEL (label), slot->title);

    if (slot->location != NULL)
    {
        /* Set the tooltip on the label's parent (the tab label hbox),
         * so it covers all of the tab label.
         */
        location_name = g_file_get_parse_name (slot->location);
        gtk_widget_set_tooltip_text (gtk_widget_get_parent (label), location_name);
        g_free (location_name);
    }
    else
    {
        gtk_widget_set_tooltip_text (gtk_widget_get_parent (label), NULL);
    }
}
static void
caja_window_slot_active (CajaWindowSlot *slot)
{
    CajaWindow *window;
    CajaWindowPane *pane;

    g_assert (CAJA_IS_WINDOW_SLOT (slot));

    pane = CAJA_WINDOW_PANE (slot->pane);
    window = CAJA_WINDOW (slot->pane->window);
    g_assert (g_list_find (pane->slots, slot) != NULL);
    g_assert (slot == window->details->active_pane->active_slot);

    EEL_CALL_METHOD (CAJA_WINDOW_SLOT_CLASS, slot,
                     active, (slot));
}
Exemple #3
0
void
caja_notebook_sync_loading (CajaNotebook *notebook,
                            CajaWindowSlot *slot)
{
    GtkWidget *tab_label, *spinner, *icon;
    gboolean active;

    g_return_if_fail (CAJA_IS_NOTEBOOK (notebook));
    g_return_if_fail (CAJA_IS_WINDOW_SLOT (slot));

    tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook), slot->content_box);
    g_return_if_fail (GTK_IS_WIDGET (tab_label));

    spinner = GTK_WIDGET (g_object_get_data (G_OBJECT (tab_label), "spinner"));
    icon = GTK_WIDGET (g_object_get_data (G_OBJECT (tab_label), "icon"));
    g_return_if_fail (spinner != NULL && icon != NULL);

    active = FALSE;
    g_object_get (spinner, "active", &active, NULL);
    if (active == slot->allow_stop)
    {
        return;
    }

    if (slot->allow_stop)
    {
        gtk_widget_hide (icon);
        gtk_widget_show (spinner);
        gtk_spinner_start (GTK_SPINNER (spinner));
    }
    else
    {
        gtk_spinner_stop (GTK_SPINNER (spinner));
        gtk_widget_hide (spinner);
        gtk_widget_show (icon);
    }
}
Exemple #4
0
int
caja_notebook_add_tab (CajaNotebook *notebook,
                       CajaWindowSlot *slot,
                       int position,
                       gboolean jump_to)
{
    GtkNotebook *gnotebook = GTK_NOTEBOOK (notebook);
    GtkWidget *tab_label;

    g_return_val_if_fail (CAJA_IS_NOTEBOOK (notebook), -1);
    g_return_val_if_fail (CAJA_IS_WINDOW_SLOT (slot), -1);

    tab_label = build_tab_label (notebook, slot);

    position = gtk_notebook_insert_page (GTK_NOTEBOOK (notebook),
                                         slot->content_box,
                                         tab_label,
                                         position);

    caja_notebook_sync_tab_label (notebook, slot);
    caja_notebook_sync_loading (notebook, slot);


    /* FIXME gtk bug! */
    /* FIXME: this should be fixed in gtk 2.12; check & remove this! */
    /* The signal handler may have reordered the tabs */
    position = gtk_notebook_page_num (gnotebook, slot->content_box);

    if (jump_to)
    {
        gtk_notebook_set_current_page (gnotebook, position);

    }

    return position;
}