From d48bdbc94baf74ac70cb47827fc08f33aacde14f Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 10 Oct 2011 01:51:52 +0000 Subject: Make kgtk-qt3 hook into gtk_dialog_add_button to monitor for response ID changes This, when combined with the previous patch, should fix Firefox not opening files when requested Bugs affected: 505 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kgtk-qt3@1258110 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- gtk2/kgtk2.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/gtk2/kgtk2.c b/gtk2/kgtk2.c index 933d4db..fe2ce7a 100644 --- a/gtk2/kgtk2.c +++ b/gtk2/kgtk2.c @@ -1904,6 +1904,46 @@ void g_signal_stop_emission_by_name(gpointer instance, const gchar *detailed_sig #endif } +GtkWidget * gtk_dialog_add_button(GtkDialog *dialog, const gchar *button_text, gint response_id) +{ + static void * (*realFunction)() = NULL; + + GtkWidget *dlg=NULL; + KGtkFileData *data=NULL; + + if(!realFunction) + realFunction = (void *(*)()) real_dlsym(RTLD_NEXT, "gtk_dialog_add_button"); + dlg = realFunction(dialog, button_text, response_id); + + determineAppName(); + if ((kgtkApp == APP_UNKNOWN) && BLACKLIST_UNKNOWN_GTK_APPS && realFunction) { +#ifdef KGTK_DEBUG + printf("KGTK::gtk_dialog_add_button Bypassing internal function\n\r"); fflush(stdout); +#endif + return dlg; + } + +#ifdef KGTK_DEBUG + printf("KGTK::gtk_dialog_add_button\n"); +#endif + data=lookupHash(dialog, TRUE); + + if(button_text && (0==strcmp(button_text, GTK_STOCK_CANCEL) || 0==strcmp(button_text, GTK_STOCK_CLOSE) || + 0==strcmp(button_text, GTK_STOCK_QUIT) || 0==strcmp(button_text, GTK_STOCK_NO))) { + data->cancel=response_id; +#ifdef KGTK_DEBUG + printf("KGTK::gtk_dialog_add_button Overriding data->cancel: %d\n\r", data->cancel); +#endif + } + else if(button_text && (0==strcmp(button_text, GTK_STOCK_OK) || 0==strcmp(button_text, GTK_STOCK_OPEN) || + 0==strcmp(button_text, GTK_STOCK_SAVE) || 0==strcmp(button_text, GTK_STOCK_YES))) { + data->ok=response_id; +#ifdef KGTK_DEBUG + printf("KGTK::gtk_dialog_add_button Overriding data->ok: %d\n\r", data->ok); +#endif + } +} + void gtk_dialog_add_buttons(GtkDialog *dialog, const gchar *first_button_text, ...) { KGtkFileData *data=NULL; @@ -2134,6 +2174,9 @@ static void * kgtk_get_fnptr(const char *raw_name) else if(0==strcmp(raw_name, "gtk_file_chooser_dialog_new")) return >k_file_chooser_dialog_new; + else if(0==strcmp(raw_name, "gtk_dialog_add_button")) + return >k_dialog_add_button; + else if(0==strcmp(raw_name, "gtk_dialog_add_buttons")) return >k_dialog_add_buttons; -- cgit v1.2.1