sokoke

sokoke

Synopsis

#include <midori/midori.h>

gchar *             sokoke_js_script_eval               (JSContextRef js_context,
                                                         const gchar *script,
                                                         gchar **exception);
void                sokoke_message_dialog               (GtkMessageType message_type,
                                                         const gchar *short_message,
                                                         const gchar *detailed_message,
                                                         gboolean modal);
gboolean            sokoke_show_uri_with_mime_type      (GdkScreen *screen,
                                                         const gchar *uri,
                                                         const gchar *mime_type,
                                                         guint32 timestamp,
                                                         GError **error);
gboolean            sokoke_show_uri                     (GdkScreen *screen,
                                                         const gchar *uri,
                                                         guint32 timestamp,
                                                         GError **error);
gchar *             sokoke_prepare_command              (const gchar *command,
                                                         gboolean quote_command,
                                                         const gchar *argument,
                                                         gboolean quote_argument);
gboolean            sokoke_spawn_program                (const gchar *command,
                                                         gboolean quote_command,
                                                         const gchar *argument,
                                                         gboolean quote_argument,
                                                         gboolean sync);
void                sokoke_spawn_gdb                    (const gchar *gdb,
                                                         gboolean sync);
void                sokoke_spawn_app                    (const gchar *uri,
                                                         gboolean inherit_config);
gboolean            sokoke_external_uri                 (const gchar *uri);
gchar *             sokoke_magic_uri                    (const gchar *uri,
                                                         gboolean allow_search,
                                                         gboolean allow_realtive);
void                sokoke_widget_set_visible           (GtkWidget *widget,
                                                         gboolean visible);
GtkWidget *         sokoke_xfce_header_new              (const gchar *icon,
                                                         const gchar *title);
gboolean            sokoke_key_file_save_to_file        (GKeyFile *key_file,
                                                         const gchar *filename,
                                                         GError **error);
void                sokoke_widget_get_text_size         (GtkWidget *widget,
                                                         const gchar *text,
                                                         gint *width,
                                                         gint *height);
gint64              sokoke_time_t_to_julian             (const time_t *timestamp);
gchar *             sokoke_replace_variables            (const gchar *template,
                                                         const gchar *variable_first,
                                                         ...);
gboolean            sokoke_window_activate_key          (GtkWindow *window,
                                                         GdkEventKey *event);
guint               sokoke_gtk_action_count_modifiers   (GtkAction *action);
gboolean            sokoke_prefetch_uri                 (MidoriWebSettings *settings,
                                                         const char *uri,
                                                         GCallback callback,
                                                         gpointer user_data);
gboolean            sokoke_resolve_hostname             (const gchar *hostname);
gboolean            sokoke_recursive_fork_protection    (const gchar *uri,
                                                         gboolean set_uri);
void                sokoke_widget_copy_clipboard        (GtkWidget *widget,
                                                         const gchar *text,
                                                         GtkClipboardGetFunc get_cb,
                                                         gpointer owner);
GtkWidget *         sokoke_search_entry_new             (const gchar *placeholder_text);
gchar *             sokoke_get_win32_desktop_lnk_path_for_filename
                                                        (gchar *filename);
void                sokoke_create_win32_desktop_lnk     (gchar *prefix,
                                                         gchar *filename,
                                                         gchar *uri);

Description

Details

sokoke_js_script_eval ()

gchar *             sokoke_js_script_eval               (JSContextRef js_context,
                                                         const gchar *script,
                                                         gchar **exception);

sokoke_message_dialog ()

void                sokoke_message_dialog               (GtkMessageType message_type,
                                                         const gchar *short_message,
                                                         const gchar *detailed_message,
                                                         gboolean modal);

sokoke_show_uri_with_mime_type ()

gboolean            sokoke_show_uri_with_mime_type      (GdkScreen *screen,
                                                         const gchar *uri,
                                                         const gchar *mime_type,
                                                         guint32 timestamp,
                                                         GError **error);

sokoke_show_uri ()

gboolean            sokoke_show_uri                     (GdkScreen *screen,
                                                         const gchar *uri,
                                                         guint32 timestamp,
                                                         GError **error);

Shows the specified URI with an application or xdg-open. x-scheme-handler is supported for GLib < 2.28 as of 0.3.3.

screen :

a GdkScreen, or NULL

uri :

the URI to show

timestamp :

the timestamp of the event

error :

the location of a GError, or NULL

Returns :

TRUE on success, FALSE if an error occurred

sokoke_prepare_command ()

gchar *             sokoke_prepare_command              (const gchar *command,
                                                         gboolean quote_command,
                                                         const gchar *argument,
                                                         gboolean quote_argument);

If command contains s, argument will be quoted and inserted into command, which is left unquoted regardless of quote_command.

command :

the command, properly quoted

argument :

any arguments, properly quoted

quote_command :

if TRUE, command will be quoted

quote_argument :

if TRUE, argument will be quoted, ie. a URI or filename

Returns :

the command prepared for spawning

sokoke_spawn_program ()

gboolean            sokoke_spawn_program                (const gchar *command,
                                                         gboolean quote_command,
                                                         const gchar *argument,
                                                         gboolean quote_argument,
                                                         gboolean sync);

If command contains s, argument will be quoted and inserted into command, which is left unquoted regardless of quote_command.

command :

the command, properly quoted

argument :

any arguments, properly quoted

quote_command :

if TRUE, command will be quoted

quote_argument :

if TRUE, argument will be quoted, ie. a URI or filename

sync :

spawn synchronously and wait for command to exit

Returns :

TRUE on success, FALSE if an error occurred

sokoke_spawn_gdb ()

void                sokoke_spawn_gdb                    (const gchar *gdb,
                                                         gboolean sync);

sokoke_spawn_app ()

void                sokoke_spawn_app                    (const gchar *uri,
                                                         gboolean inherit_config);

sokoke_external_uri ()

gboolean            sokoke_external_uri                 (const gchar *uri);

sokoke_magic_uri ()

gchar *             sokoke_magic_uri                    (const gchar *uri,
                                                         gboolean allow_search,
                                                         gboolean allow_realtive);

Takes a string that was typed by a user, guesses what it is, and returns an URI.

If it was a search, NULL will be returned.

uri :

a string typed by a user

Returns :

a newly allocated URI, or NULL

sokoke_widget_set_visible ()

void                sokoke_widget_set_visible           (GtkWidget *widget,
                                                         gboolean visible);

sokoke_xfce_header_new ()

GtkWidget *         sokoke_xfce_header_new              (const gchar *icon,
                                                         const gchar *title);

Creates an Xfce style header *if* Xfce is running.

icon :

an icon name

title :

the title of the header

Returns :

A GtkWidget or NULL Since 0.1.2 icon may be NULL, and a default is used.

sokoke_key_file_save_to_file ()

gboolean            sokoke_key_file_save_to_file        (GKeyFile *key_file,
                                                         const gchar *filename,
                                                         GError **error);

sokoke_widget_get_text_size ()

void                sokoke_widget_get_text_size         (GtkWidget *widget,
                                                         const gchar *text,
                                                         gint *width,
                                                         gint *height);

sokoke_time_t_to_julian ()

gint64              sokoke_time_t_to_julian             (const time_t *timestamp);

Calculates a unix timestamp to a julian day value.

timestamp :

a time_t timestamp value

Returns :

an integer.

sokoke_replace_variables ()

gchar *             sokoke_replace_variables            (const gchar *template,
                                                         const gchar *variable_first,
                                                         ...);

sokoke_window_activate_key ()

gboolean            sokoke_window_activate_key          (GtkWindow *window,
                                                         GdkEventKey *event);

Attempts to activate they key from the event, much like gtk_window_activate_key(), including keys that gtk_accelerator_valid() considers invalid.

window :

a GtkWindow

event :

a GdkEventKey

Returns :

TRUE on success

sokoke_gtk_action_count_modifiers ()

guint               sokoke_gtk_action_count_modifiers   (GtkAction *action);

Counts the number of modifiers in the accelerator belonging to the action.

action :

a GtkAction

Returns :

the number of modifiers

sokoke_prefetch_uri ()

gboolean            sokoke_prefetch_uri                 (MidoriWebSettings *settings,
                                                         const char *uri,
                                                         GCallback callback,
                                                         gpointer user_data);

Attempts to prefetch the specified URI, that is it tries to resolve the hostname in advance.

settings :

a MidoriWebSettings instance, or NULL

uri :

an URI string

Returns :

TRUE on success

sokoke_resolve_hostname ()

gboolean            sokoke_resolve_hostname             (const gchar *hostname);

Takes a string that was typed by a user, resolves the hostname, and returns the status.

hostname :

a string typed by a user

Returns :

TRUE if is a valid host, else FALSE

sokoke_recursive_fork_protection ()

gboolean            sokoke_recursive_fork_protection    (const gchar *uri,
                                                         gboolean set_uri);

Protects against recursive invokations of the Midori executable with the same URI.

As an example, consider having an URI starting with 'tel://'. You could attempt to open it with sokoke_show_uri. In turn, 'exo-open' might be called. Now quite possibly 'exo-open' is unable to handle 'tel://' and might well fall back to 'midori' as default browser.

To protect against this scenario, call this function with the URI and TRUE before calling any external tool. MidoriApp calls sokoke_recursive_fork_protection() with FALSE and bails out if FALSE is returned.

uri :

the URI to check

set_uri :

if TRUE the URI will be saved

Returns :

TRUE if uri is new, FALSE on recursion

sokoke_widget_copy_clipboard ()

void                sokoke_widget_copy_clipboard        (GtkWidget *widget,
                                                         const gchar *text,
                                                         GtkClipboardGetFunc get_cb,
                                                         gpointer owner);

sokoke_search_entry_new ()

GtkWidget *         sokoke_search_entry_new             (const gchar *placeholder_text);

sokoke_get_win32_desktop_lnk_path_for_filename ()

gchar *             sokoke_get_win32_desktop_lnk_path_for_filename
                                                        (gchar *filename);

sokoke_create_win32_desktop_lnk ()

void                sokoke_create_win32_desktop_lnk     (gchar *prefix,
                                                         gchar *filename,
                                                         gchar *uri);