struct swb_context {
int continuous_mode;
void (*default_browser_launcher)(struct swb_context *, char *);
- char * other_browser_cmd;
- DBusGConnection * session_bus;
- DBusGProxy * dbus_proxy;
+ char *other_browser_cmd;
+ DBusGConnection *session_bus;
+ DBusGProxy *dbus_proxy;
};
#endif /* _BROWSER_SWITCHBOARD_H */
#include "dbus-server-glue.h"
-static void open_address(const char * uri) {
- char * new_uri;
+static void open_address(const char *uri) {
+ char *new_uri;
size_t new_uri_len;
if (!uri && uri[0] == '/') {
* The com.nokia.osso_browser D-Bus interface
*/
gboolean osso_browser_load_url(OssoBrowser *obj,
- const char * uri, GError **error) {
+ const char *uri, GError **error) {
open_address(uri);
return TRUE;
}
gboolean osso_browser_mime_open(OssoBrowser *obj,
- const char * uri, GError **error) {
+ const char *uri, GError **error) {
open_address(uri);
return TRUE;
}
gboolean osso_browser_open_new_window(OssoBrowser *obj,
- const char * uri, GError **error) {
+ const char *uri, GError **error) {
open_address(uri);
return TRUE;
}
/* This is a "undocumented", non-standard extension to the API, ONLY
for use by /usr/bin/browser wrapper to implement --url */
gboolean osso_browser_switchboard_launch_microb(OssoBrowser *obj,
- const char * uri, GError **error) {
+ const char *uri, GError **error) {
launch_microb(&ctx, (char *)uri);
return TRUE;
}
/* Register the name com.nokia.osso_browser on the D-Bus session bus */
-void dbus_request_osso_browser_name(struct swb_context * ctx) {
- GError * error = NULL;
+void dbus_request_osso_browser_name(struct swb_context *ctx) {
+ GError *error = NULL;
guint result;
if (!ctx || !ctx->dbus_proxy)
}
/* Release the name com.nokia.osso_browser on the D-Bus session bus */
-void dbus_release_osso_browser_name(struct swb_context * ctx) {
- GError * error = NULL;
+void dbus_release_osso_browser_name(struct swb_context *ctx) {
+ GError *error = NULL;
guint result;
if (!ctx || !ctx->dbus_proxy)
/* The com.nokia.osso_browser D-Bus interface */
gboolean osso_browser_load_url(OssoBrowser *obj,
- const char * uri, GError **error);
+ const char *uri, GError **error);
gboolean osso_browser_mime_open(OssoBrowser *obj,
- const char * uri, GError **error);
+ const char *uri, GError **error);
gboolean osso_browser_open_new_window(OssoBrowser *obj,
- const char * uri, GError **error);
+ const char *uri, GError **error);
gboolean osso_browser_top_application(OssoBrowser *obj, GError **error);
/* This is an "undocumented", non-standard extension; DO NOT USE */
gboolean osso_browser_switchboard_launch_microb(OssoBrowser *obj,
- const char * uri, GError **error);
+ const char *uri, GError **error);
-void dbus_request_osso_browser_name(struct swb_context * ctx);
-void dbus_release_osso_browser_name(struct swb_context * ctx);
+void dbus_request_osso_browser_name(struct swb_context *ctx);
+void dbus_release_osso_browser_name(struct swb_context *ctx);
const DBusGObjectInfo dbus_glib_osso_browser_object_info;
#define LAUNCH_DEFAULT_BROWSER launch_tear
-static void launch_tear(struct swb_context * ctx, char * uri) {
+static void launch_tear(struct swb_context *ctx, char *uri) {
int status;
- static DBusGProxy * tear_proxy = NULL;
- GError * error = NULL;
+ static DBusGProxy *tear_proxy = NULL;
+ GError *error = NULL;
pid_t pid;
if (!uri)
}
}
-void launch_microb(struct swb_context * ctx, char * uri) {
+void launch_microb(struct swb_context *ctx, char *uri) {
int kill_browserd = 0;
int status;
pid_t pid;
dbus_request_osso_browser_name(ctx);
}
-static void launch_other_browser(struct swb_context * ctx, char * uri) {
- char * command;
- char * quoted_uri;
+static void launch_other_browser(struct swb_context *ctx, char *uri) {
+ char *command;
+ char *quoted_uri, *quote;
+
size_t cmdlen, urilen;
if (!uri || !strcmp(uri, "new_window"))
uri = "";
urilen = strlen(uri);
if (urilen > 0) {
- char * quote;
-
/* Quote the URI */
/* urilen+3 = length of URI + 2x \' + \0 */
if (!(quoted_uri = calloc(urilen+3, sizeof(char))))
execl("/bin/sh", "/bin/sh", "-c", command, (char *)NULL);
}
-static void use_other_browser_cmd(struct swb_context * ctx, char * cmd) {
+static void use_other_browser_cmd(struct swb_context *ctx, char *cmd) {
size_t len = strlen(cmd);
free(ctx->other_browser_cmd);
}
}
-void update_default_browser(struct swb_context * ctx, char * default_browser) {
+void update_default_browser(struct swb_context *ctx, char *default_browser) {
if (!ctx)
return;
}
}
-void launch_browser(struct swb_context * ctx, char * uri) {
+void launch_browser(struct swb_context *ctx, char *uri) {
if (ctx && ctx->default_browser_launcher)
ctx->default_browser_launcher(ctx, uri);
}
#include "browser-switchboard.h"
-void launch_microb(struct swb_context * ctx, char * uri);
-void launch_browser(struct swb_context * ctx, char * uri);
-void update_default_browser(struct swb_context * ctx, char * default_browser);
+void launch_microb(struct swb_context *ctx, char *uri);
+void launch_browser(struct swb_context *ctx, char *uri);
+void update_default_browser(struct swb_context *ctx, char *default_browser);
#endif /* _LAUNCHER_H */
struct swb_context ctx;
-static void set_config_defaults(struct swb_context * ctx) {
+static void set_config_defaults(struct swb_context *ctx) {
if (!ctx)
return;
free(ctx->other_browser_cmd);
}
int main() {
- OssoBrowser * obj;
- GMainLoop * mainloop;
- GError * error = NULL;
+ OssoBrowser *obj;
+ GMainLoop *mainloop;
+ GError *error = NULL;
read_config(0);