void nemo_action_set_label (NemoAction *action, NemoFile *file) { const gchar *orig_label = nemo_action_get_orig_label (action); if (!test_string_for_label_token (orig_label) || file == NULL || action->selection_type != SELECTION_SINGLE) { gtk_action_set_label (GTK_ACTION (action), orig_label); return; } gchar *display_name = nemo_file_get_display_name (file); gchar **split = g_strsplit (orig_label, TOKEN_LABEL_FILE_NAME, 2); gchar *new_label = g_strconcat (split[0], display_name, split[1], NULL); gchar *escaped = eel_str_double_underscores (new_label); gtk_action_set_label (GTK_ACTION (action), escaped); g_strfreev (split); g_free (display_name); g_free (new_label); g_free (escaped); }
gchar * nemo_action_get_label (NemoAction *action, GList *selection, NemoFile *parent) { const gchar *orig_label = nemo_action_get_orig_label (action); if (orig_label == NULL) return NULL; action->escape_underscores = TRUE; GString *str = g_string_new (orig_label); str = expand_action_string (action, selection, parent, str); DEBUG ("Action Label: %s", str->str); if (action->log_output) g_printerr ("Action Label: %s\n", str->str); gchar *ret = str->str; g_string_free (str, FALSE); return ret; }