コード例 #1
0
static gboolean
tm_has_second_line(BalsaToolbarModel * model)
{
    GArray *current;
    guint j;

    /* Find out whether any button has 2 lines of text. */
    current = balsa_toolbar_model_get_current(model);
    for (j = 0; j < current->len; j++) {
        const gchar *icon;
        gint button;

        icon = g_array_index(current, BalsaToolbarEntry, j).icon;
        button = get_toolbar_button_index(icon);

        if (button >= 0 && strchr(balsa_toolbar_button_text(button), '\n'))
            return TRUE;
    }

    return FALSE;
}
コード例 #2
0
/* Add an item to a GtkTreeView's GtkListStore.
 */
static void
tp_store_set(GtkListStore * store, GtkTreeIter * iter, gint item)
{
    GdkPixbuf *pixbuf;
    gchar *text;

    text = g_strdup(balsa_toolbar_button_text(item));
    replace_nl_with_space(text);
    pixbuf =
        (item > 0
         ? gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
                                    toolbar_buttons[item].pixmap_id,
                                    GTK_ICON_SIZE_LARGE_TOOLBAR, 0, NULL)
         : NULL);
    gtk_list_store_set(store, iter,
                       TP_TEXT_COLUMN, text,
                       TP_ICON_COLUMN, pixbuf,
                       TP_ITEM_COLUMN, item,
                       -1);
    g_free(text);
    if (pixbuf)
        g_object_unref(pixbuf);
}
コード例 #3
0
static gint
tm_set_tool_item_label(GtkToolItem * tool_item, const gchar * stock_id,
                       gboolean make_two_line)
{
    gint button = get_toolbar_button_index(stock_id);
    const gchar *text;
    gchar *label;

    if (button < 0)
        return button;

    text = balsa_toolbar_button_text(button);
    if (balsa_app.toolbar_wrap_button_text) {
        /* Make sure all buttons have the same number of lines of
         * text (1 or 2), to keep icons aligned */
        label = make_two_line && !strchr(text, '\n') ?
            g_strconcat(text, "\n", NULL) : g_strdup(text);
    } else {
        gchar *p = label = g_strdup(text);
        while ((p = strchr(p, '\n')))
            *p++ = ' ';
    }

    gtk_tool_button_set_label(GTK_TOOL_BUTTON(tool_item), label);
    g_free(label);

    gtk_tool_item_set_is_important(tool_item,
                                   toolbar_buttons[button].is_important);

    if (strcmp(toolbar_buttons[button].pixmap_id, BALSA_PIXMAP_SEND) == 0
        && balsa_app.always_queue_sent_mail)
        gtk_tool_item_set_tooltip_text(tool_item,
                                       _("Queue this message for sending"));

    return button;
}