/soc/2015/mmcc/main: adf32a9a987d: replacing text_to_stock() and...
Michael McConville
mmcconville at mykolab.com
Wed Jun 24 22:39:32 EDT 2015
Changeset: adf32a9a987df73dac92a0e5afeb5cf10dbc8c9c
Author: Michael McConville <mmcconville at mykolab.com>
Date: 2015-06-24 22:39 -0400
Branch: default
URL: https://hg.pidgin.im/soc/2015/mmcc/main/rev/adf32a9a987d
Description:
replacing text_to_stock() and its calls as part of GTK Stock Items replacement
diffstat:
pidgin/gtkrequest.c | 74 ++++++++++++----------------------------------------
1 files changed, 17 insertions(+), 57 deletions(-)
diffs (157 lines):
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -320,41 +320,6 @@ destroy_multifield_cb(GtkWidget *dialog,
return FALSE;
}
-
-#define STOCK_ITEMIZE(r, l) \
- if (!strcmp((r), text) || !strcmp(_(r), text)) \
- return (l);
-
-/* XXX: this seems to serve no real purpose, especially
- * because we're switching off of Stock Items */
-static const char *
-text_to_stock(const char *text)
-{
- STOCK_ITEMIZE(N_("Yes"), GTK_STOCK_YES);
- STOCK_ITEMIZE(N_("_Yes"), GTK_STOCK_YES);
- STOCK_ITEMIZE(N_("No"), GTK_STOCK_NO);
- STOCK_ITEMIZE(N_("_No"), GTK_STOCK_NO);
- STOCK_ITEMIZE(N_("OK"), GTK_STOCK_OK);
- STOCK_ITEMIZE(N_("_OK"), GTK_STOCK_OK);
- STOCK_ITEMIZE(N_("Cancel"), GTK_STOCK_CANCEL);
- STOCK_ITEMIZE(N_("_Cancel"), GTK_STOCK_CANCEL);
- STOCK_ITEMIZE(N_("Apply"), GTK_STOCK_APPLY);
- STOCK_ITEMIZE(N_("Close"), GTK_STOCK_CLOSE);
- STOCK_ITEMIZE(N_("Delete"), GTK_STOCK_DELETE);
- STOCK_ITEMIZE(N_("Add"), GTK_STOCK_ADD);
- STOCK_ITEMIZE(N_("Remove"), GTK_STOCK_REMOVE);
- STOCK_ITEMIZE(N_("Save"), GTK_STOCK_SAVE);
- STOCK_ITEMIZE(N_("Next"), PIDGIN_STOCK_NEXT);
- STOCK_ITEMIZE(N_("_Next"), PIDGIN_STOCK_NEXT);
- STOCK_ITEMIZE(N_("Back"), GTK_STOCK_GO_BACK);
- STOCK_ITEMIZE(N_("_Back"), GTK_STOCK_GO_BACK);
- STOCK_ITEMIZE(N_("Alias"), PIDGIN_STOCK_ALIAS);
-
- return text;
-}
-
-#undef STOCK_ITEMIZE
-
static gchar *
pidgin_request_escape(PurpleRequestCommonParameters *cpar, const gchar *text)
{
@@ -514,8 +479,8 @@ static void *
pidgin_request_input(const char *title, const char *primary,
const char *secondary, const char *default_value,
gboolean multiline, gboolean masked, gchar *hint,
- const char *ok_text, GCallback ok_cb,
- const char *cancel_text, GCallback cancel_cb,
+ GCallback ok_cb,
+ GCallback cancel_cb,
PurpleRequestCommonParameters *cpar,
void *user_data)
{
@@ -543,7 +508,7 @@ pidgin_request_input(const char *title,
dialog = gtk_dialog_new_with_buttons(title ? title : PIDGIN_ALERT_TITLE,
NULL, 0,
_("_Cancel"), 1,
- text_to_stock(ok_text), 0,
+ _("_OK"), 0,
NULL);
data->dialog = dialog;
@@ -667,8 +632,8 @@ pidgin_request_input(const char *title,
static void *
pidgin_request_choice(const char *title, const char *primary,
- const char *secondary, gpointer default_value, const char *ok_text,
- GCallback ok_cb, const char *cancel_text, GCallback cancel_cb,
+ const char *secondary, gpointer default_value,
+ GCallback ok_cb, GCallback cancel_cb,
PurpleRequestCommonParameters *cpar, void *user_data, va_list args)
{
PidginRequestData *data;
@@ -701,10 +666,10 @@ pidgin_request_choice(const char *title,
#endif
gtk_dialog_add_button(GTK_DIALOG(dialog),
- text_to_stock(cancel_text), 0);
+ _("_Cancel"), 0);
gtk_dialog_add_button(GTK_DIALOG(dialog),
- text_to_stock(ok_text), 1);
+ _("_OK"), 1);
g_signal_connect(G_OBJECT(dialog), "response",
G_CALLBACK(choice_response_cb), data);
@@ -822,7 +787,7 @@ pidgin_request_action(const char *title,
for (i = 0; i < action_count; i++) {
gtk_dialog_add_button(GTK_DIALOG(dialog),
- text_to_stock(buttons[2 * i]), i);
+ buttons[2 * i], i);
data->cbs[i] = buttons[2 * i + 1];
}
@@ -960,7 +925,7 @@ pidgin_request_wait(const char *title, c
/* Cancel button */
button = pidgin_dialog_add_button(GTK_DIALOG(dialog),
- text_to_stock(_("Cancel")), G_CALLBACK(wait_cancel_cb), data);
+ _("Cancel"), G_CALLBACK(wait_cancel_cb), data);
gtk_widget_set_can_default(button, FALSE);
/* Vertical box */
@@ -1954,8 +1919,8 @@ create_datasheet_field(PurpleRequestFiel
static void *
pidgin_request_fields(const char *title, const char *primary,
- const char *secondary, PurpleRequestFields *fields, const char *ok_text,
- GCallback ok_cb, const char *cancel_text, GCallback cancel_cb,
+ const char *secondary, PurpleRequestFields *fields,
+ GCallback ok_cb, GCallback cancel_cb,
PurpleRequestCommonParameters *cpar, void *user_data)
{
PidginRequestData *data;
@@ -1979,7 +1944,6 @@ pidgin_request_fields(const char *title,
size_t extra_actions_count, i;
const gchar **tab_names;
guint tab_count;
- gboolean ok_btn = (ok_text != NULL);
data = g_new0(PidginRequestData, 1);
data->type = PURPLE_REQUEST_FIELDS;
@@ -2025,24 +1989,20 @@ pidgin_request_fields(const char *title,
PurpleRequestFieldsCb *cb = it->next->data;
button = pidgin_dialog_add_button(GTK_DIALOG(win),
- text_to_stock(label), G_CALLBACK(multifield_extra_cb),
+ _(label), G_CALLBACK(multifield_extra_cb),
data);
g_object_set_data(G_OBJECT(button), "extra-cb", cb);
}
/* Cancel button */
- button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(cancel_text), G_CALLBACK(multifield_cancel_cb), data);
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), _("_Cancel"), G_CALLBACK(multifield_cancel_cb), data);
gtk_widget_set_can_default(button, TRUE);
/* OK button */
- if (!ok_btn) {
- gtk_window_set_default(GTK_WINDOW(win), button);
- } else {
- button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(ok_text), G_CALLBACK(multifield_ok_cb), data);
- data->ok_button = button;
- gtk_widget_set_can_default(button, TRUE);
- gtk_window_set_default(GTK_WINDOW(win), button);
- }
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), _("_OK"), G_CALLBACK(multifield_ok_cb), data);
+ data->ok_button = button;
+ gtk_widget_set_can_default(button, TRUE);
+ gtk_window_set_default(GTK_WINDOW(win), button);
pidgin_widget_decorate_account(hbox,
purple_request_cpar_get_account(cpar));
More information about the Commits
mailing list