diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-10-16 00:10:01 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-10-16 00:10:01 +0000 |
commit | a2ac0d637fa5e5061aac07f1387117065a283456 (patch) | |
tree | d7ed024c52ffe1d95ede3ae08d702d6528799488 /xparts | |
parent | b6bf0b1151892d0defc5e9e94ccc442b58a6f810 (diff) | |
download | tdebindings-a2ac0d637fa5e5061aac07f1387117065a283456.tar.gz tdebindings-a2ac0d637fa5e5061aac07f1387117065a283456.zip |
Implement support for updating the status bar when the mouse cursor is above a link (and by javascript) and the window title is updated when a page is loaded in the mozilla pluginv3.5.13
Thanks to Julius Schwartzenberg for the patch!
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1259023 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'xparts')
-rw-r--r-- | xparts/mozilla/kmozilla.c | 29 | ||||
-rw-r--r-- | xparts/src/gtk/gtkbrowserextension.c | 38 | ||||
-rw-r--r-- | xparts/src/gtk/gtkbrowserextension.h | 2 |
3 files changed, 69 insertions, 0 deletions
diff --git a/xparts/mozilla/kmozilla.c b/xparts/mozilla/kmozilla.c index dd65666c..00741591 100644 --- a/xparts/mozilla/kmozilla.c +++ b/xparts/mozilla/kmozilla.c @@ -43,6 +43,9 @@ static void handle_reload(GtkObject *obj, gpointer user_data); /* signal handlers for gtkmozembed signals */ static gboolean open_url_request(GtkObject *obj, const char *url); +static void set_status_bar_link_message(GtkObject *obj); +static void set_status_bar_javascript_status(GtkObject *obj); +static void set_window_caption(GtkObject *obj); /* --------------------------- implementations --------------------------------------- */ @@ -120,6 +123,12 @@ gtk_kmozilla_init(GtkKmozilla *part) GTK_SIGNAL_FUNC(handle_reload), NULL); */ gtk_signal_connect(GTK_OBJECT(moz), "open_uri", GTK_SIGNAL_FUNC(open_url_request), NULL); + gtk_signal_connect(GTK_OBJECT(moz), "link_message", + GTK_SIGNAL_FUNC(set_status_bar_link_message), NULL); + gtk_signal_connect(GTK_OBJECT(moz), "js_status", + GTK_SIGNAL_FUNC(set_status_bar_javascript_status), NULL); + gtk_signal_connect(GTK_OBJECT(moz), "title", + GTK_SIGNAL_FUNC(set_window_caption), NULL); mozilla = part; g_message( "gtk_kmozilla_init\n" ); @@ -194,3 +203,23 @@ static gboolean open_url_request(GtkObject *obj, const char * url) return req; } +static void set_status_bar_link_message(GtkObject *obj) +{ + g_message("==================>>>>>>> kmozilla::setStatusBarLinkMessage"); + gtk_browserextension_set_status_bar_text( ((GtkKmozillaPrivate *)mozilla->data)->ext, + gtk_moz_embed_get_link_message( ((GtkKmozillaPrivate *)mozilla->data)->mozilla ) ); +} + +static void set_status_bar_javascript_status(GtkObject *obj) +{ + g_message("==================>>>>>>> kmozilla::setStatusBarJavascriptStatus"); + gtk_browserextension_set_status_bar_text( ((GtkKmozillaPrivate *)mozilla->data)->ext, + gtk_moz_embed_get_js_status( ((GtkKmozillaPrivate *)mozilla->data)->mozilla ) ); +} + +static void set_window_caption(GtkObject *obj) +{ + g_message("==================>>>>>>> kmozilla::setWindowCaption"); + gtk_browserextension_set_window_caption( ((GtkKmozillaPrivate *)mozilla->data)->ext, + gtk_moz_embed_get_title( ((GtkKmozillaPrivate *)mozilla->data)->mozilla ) ); +} diff --git a/xparts/src/gtk/gtkbrowserextension.c b/xparts/src/gtk/gtkbrowserextension.c index 7e2310e6..5885f5c7 100644 --- a/xparts/src/gtk/gtkbrowserextension.c +++ b/xparts/src/gtk/gtkbrowserextension.c @@ -242,3 +242,41 @@ gboolean gtk_browserextension_open_url_request( GtkXBrowserExtension *part, cons } return TRUE; } + +gboolean gtk_browserextension_set_status_bar_text( GtkXBrowserExtension *part, const char *info ) +{ + dcop_data *reply_data; + char *reply_type; + dcop_data *data = dcop_data_ref( dcop_data_new() ); + + if(!P->client) + fprintf(stderr, "register a dcop client first!\n"); + + dcop_marshal_string16( data, info ); + + if ( !dcop_client_call( P->client, P->host_app_id, "parthost", "setStatusBarText(TQString)", data, + &reply_type, &reply_data ) ) { + g_warning(" setStatusBarText failed"); + return FALSE; + } + return TRUE; +} + +gboolean gtk_browserextension_set_window_caption( GtkXBrowserExtension *part, const char *info ) +{ + dcop_data *reply_data; + char *reply_type; + dcop_data *data = dcop_data_ref( dcop_data_new() ); + + if(!P->client) + fprintf(stderr, "register a dcop client first!\n"); + + dcop_marshal_string16( data, info ); + + if ( !dcop_client_call( P->client, P->host_app_id, "parthost", "setWindowCaption(TQString)", data, + &reply_type, &reply_data ) ) { + g_warning(" setWindowCaption failed"); + return FALSE; + } + return TRUE; +} diff --git a/xparts/src/gtk/gtkbrowserextension.h b/xparts/src/gtk/gtkbrowserextension.h index 7efbd938..b66a53bc 100644 --- a/xparts/src/gtk/gtkbrowserextension.h +++ b/xparts/src/gtk/gtkbrowserextension.h @@ -42,6 +42,8 @@ extern GtkType gtk_xbrowserextension_get_type (void); extern GtkXBrowserExtension *gtk_xbrowserextension_new (void); gboolean gtk_browserextension_open_url_request( GtkXBrowserExtension *ext, const char *url ); +gboolean gtk_browserextension_set_status_bar_text( GtkXBrowserExtension *ext, const char *info ); +gboolean gtk_browserextension_set_window_caption( GtkXBrowserExtension *ext, const char *info ); /* "virtual" functions from DcopObject */ void gtk_xbrowserextension_set_dcop_client( GtkXBrowserExtension *part, DcopClient *client ); |