1 # HG changeset patch |
1 # HG changeset patch |
2 # Parent 1e6ab61ae64f601da61197f34ad145f54a400b1f |
2 # Parent fc87d8519207c57c22fb5a01243722be530679fa |
3 Description: Add KDE integration to Firefox (toolkit parts) |
3 Description: Add KDE integration to Firefox (toolkit parts) |
4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org> |
4 Author: Wolfgang Rosenauer <wolfgang@rosenauer.org> |
5 Author: Lubos Lunak <lunak@suse.com> |
5 Author: Lubos Lunak <lunak@suse.com> |
6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751 |
6 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=140751 |
7 https://bugzilla.novell.com/show_bug.cgi?id=170055 |
7 https://bugzilla.novell.com/show_bug.cgi?id=170055 |
2501 + NS_ADDREF( *output = result); |
2501 + NS_ADDREF( *output = result); |
2502 + return ret; |
2502 + return ret; |
2503 + } |
2503 + } |
2504 + |
2504 + |
2505 + |
2505 + |
2506 +bool nsKDEUtils::commandBlockUi( const nsTArray<nsCString>& command, const GtkWindow* parent, nsTArray<nsCString>* output ) |
2506 +bool nsKDEUtils::commandBlockUi( const nsTArray<nsCString>& command, GtkWindow* parent, nsTArray<nsCString>* output ) |
2507 + { |
2507 + { |
2508 + return self()->internalCommand( command, parent, true, output ); |
2508 + return self()->internalCommand( command, parent, true, output ); |
2509 + } |
2509 + } |
2510 + |
2510 + |
2511 +bool nsKDEUtils::internalCommand( const nsTArray<nsCString>& command, const GtkWindow* parent, bool blockUi, |
2511 +bool nsKDEUtils::internalCommand( const nsTArray<nsCString>& command, GtkWindow* parent, bool blockUi, |
2512 + nsTArray<nsCString>* output ) |
2512 + nsTArray<nsCString>* output ) |
2513 + { |
2513 + { |
2514 + if( !startHelper()) |
2514 + if( !startHelper()) |
2515 + return false; |
2515 + return false; |
2516 + feedCommand( command ); |
2516 + feedCommand( command ); |
2522 + data.success = false; |
2522 + data.success = false; |
2523 + if( blockUi ) |
2523 + if( blockUi ) |
2524 + { |
2524 + { |
2525 + data.loop = g_main_loop_new( NULL, FALSE ); |
2525 + data.loop = g_main_loop_new( NULL, FALSE ); |
2526 + GtkWidget* window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); |
2526 + GtkWidget* window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); |
2527 + if( parent && parent->group ) |
2527 + if( parent && gtk_window_get_group(parent) ) |
2528 + gtk_window_group_add_window( parent->group, GTK_WINDOW( window )); |
2528 + gtk_window_group_add_window( gtk_window_get_group(parent), GTK_WINDOW( window )); |
2529 + gtk_widget_realize( window ); |
2529 + gtk_widget_realize( window ); |
2530 + gtk_widget_set_sensitive( window, TRUE ); |
2530 + gtk_widget_set_sensitive( window, TRUE ); |
2531 + gtk_grab_add( window ); |
2531 + gtk_grab_add( window ); |
2532 + GIOChannel* channel = g_io_channel_unix_new( fileno( data.file )); |
2532 + GIOChannel* channel = g_io_channel_unix_new( fileno( data.file )); |
2533 + g_io_add_watch( channel, static_cast< GIOCondition >( G_IO_IN | G_IO_ERR | G_IO_HUP ), kdeReadFunc, &data ); |
2533 + g_io_add_watch( channel, static_cast< GIOCondition >( G_IO_IN | G_IO_ERR | G_IO_HUP ), kdeReadFunc, &data ); |
2676 + static bool command( const nsTArray<nsCString>& command, nsTArray<nsCString>* output = NULL ); |
2676 + static bool command( const nsTArray<nsCString>& command, nsTArray<nsCString>* output = NULL ); |
2677 + static bool command( nsIArray* command, nsIArray** output = NULL ); |
2677 + static bool command( nsIArray* command, nsIArray** output = NULL ); |
2678 + /* Like command(), but additionally blocks the parent widget like if there was |
2678 + /* Like command(), but additionally blocks the parent widget like if there was |
2679 + a modal dialog shown and enters the event loop (i.e. there are still paint updates, |
2679 + a modal dialog shown and enters the event loop (i.e. there are still paint updates, |
2680 + this is for commands that take long). */ |
2680 + this is for commands that take long). */ |
2681 + static bool commandBlockUi( const nsTArray<nsCString>& command, const GtkWindow* parent, nsTArray<nsCString>* output = NULL ); |
2681 + static bool commandBlockUi( const nsTArray<nsCString>& command, GtkWindow* parent, nsTArray<nsCString>* output = NULL ); |
2682 + |
2682 + |
2683 + private: |
2683 + private: |
2684 + nsKDEUtils(); |
2684 + nsKDEUtils(); |
2685 + ~nsKDEUtils(); |
2685 + ~nsKDEUtils(); |
2686 + static nsKDEUtils* self(); |
2686 + static nsKDEUtils* self(); |
2687 + bool startHelper(); |
2687 + bool startHelper(); |
2688 + void closeHelper(); |
2688 + void closeHelper(); |
2689 + void feedCommand( const nsTArray<nsCString>& command ); |
2689 + void feedCommand( const nsTArray<nsCString>& command ); |
2690 + bool internalCommand( const nsTArray<nsCString>& command, const GtkWindow* parent, bool isParent, |
2690 + bool internalCommand( const nsTArray<nsCString>& command, GtkWindow* parent, bool isParent, |
2691 + nsTArray<nsCString>* output ); |
2691 + nsTArray<nsCString>* output ); |
2692 + FILE* commandFile; |
2692 + FILE* commandFile; |
2693 + FILE* replyFile; |
2693 + FILE* replyFile; |
2694 + }; |
2694 + }; |
2695 + |
2695 + |