Ejemplo n.º 1
0
void
nemo_action_set_tt (NemoAction *action, NemoFile *file)
{
    const gchar *orig_tt = nemo_action_get_orig_tt (action);

    if (!test_string_for_label_token (orig_tt) || file == NULL ||
        action->selection_type != SELECTION_SINGLE) {
        gtk_action_set_tooltip (GTK_ACTION (action), orig_tt);
        return;
    }

    gchar *display_name = nemo_file_get_display_name (file);

    gchar **split = g_strsplit (orig_tt, TOKEN_LABEL_FILE_NAME, 2);

    gchar *new_tt = g_strconcat (split[0], display_name, split[1], NULL);

    gchar *escaped = eel_str_double_underscores (new_tt);

    gtk_action_set_tooltip (GTK_ACTION (action), escaped);

    g_strfreev (split);
    g_free (display_name);
    g_free (new_tt);
    g_free (escaped);
}
Ejemplo n.º 2
0
gchar *
nemo_action_get_tt (NemoAction *action, GList *selection, NemoFile *parent)
{
    const gchar *orig_tt = nemo_action_get_orig_tt (action);

    if (orig_tt == NULL)
        return NULL;

    action->escape_underscores = FALSE;

    GString *str = g_string_new (orig_tt);

    str = expand_action_string (action, selection, parent, str);

    DEBUG ("Action Tooltip: %s", str->str);
    if (action->log_output)
        g_printerr ("Action Tooltip: %s\n", str->str);

    gchar *ret = str->str;
    g_string_free (str, FALSE);
    return ret;
}