/pidgin/main: d3f26f67a5ef: Allow Request API dialog with only o...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Tue Jan 7 09:50:35 EST 2014
Changeset: d3f26f67a5efe4c99b2cee5aa127533143a9b6ce
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-01-07 15:50 +0100
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/d3f26f67a5ef
Description:
Allow Request API dialog with only one closing button
diffstat:
libpurple/request.c | 6 +++---
pidgin/gtkrequest.c | 14 +++++++++-----
2 files changed, 12 insertions(+), 8 deletions(-)
diffs (58 lines):
diff --git a/libpurple/request.c b/libpurple/request.c
--- a/libpurple/request.c
+++ b/libpurple/request.c
@@ -2375,13 +2375,13 @@ purple_request_fields(void *handle, cons
{
PurpleRequestUiOps *ops;
- if (G_UNLIKELY(fields == NULL || ok_text == NULL || ok_cb == NULL ||
+ if (G_UNLIKELY(fields == NULL ||
+ ((ok_text == NULL) != (ok_cb == NULL)) ||
cancel_text == NULL))
{
purple_request_cpar_unref(cpar);
g_warn_if_fail(fields != NULL);
- g_warn_if_fail(ok_text != NULL);
- g_warn_if_fail(ok_cb != NULL);
+ g_warn_if_fail((ok_text == NULL) != (ok_cb == NULL));
g_warn_if_fail(cancel_text != NULL);
g_return_val_if_reached(NULL);
}
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -1991,6 +1991,7 @@ 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;
@@ -2008,7 +2009,6 @@ pidgin_request_fields(const char *title,
data->cbs[0] = ok_cb;
data->cbs[1] = cancel_cb;
-
#ifdef _WIN32
data->dialog = win = pidgin_create_dialog(PIDGIN_ALERT_TITLE, PIDGIN_HIG_BORDER, "multifield", TRUE) ;
#else /* !_WIN32 */
@@ -2047,10 +2047,14 @@ pidgin_request_fields(const char *title,
gtk_widget_set_can_default(button, TRUE);
/* OK button */
- 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);
+ 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);
+ }
pidgin_widget_decorate_account(hbox,
purple_request_cpar_get_account(cpar));
More information about the Commits
mailing list