From 01d7a268b1433c37b6964a3590c56b8d9c9068f9 Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Thu, 30 Apr 2009 16:40:11 +0100 Subject: Fixed FIFO problem. Merged dieterbe/experimental. --- uzbl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 75616af..4807b72 100644 --- a/uzbl.c +++ b/uzbl.c @@ -401,7 +401,13 @@ control_fifo(GIOChannel *fd) { g_io_channel_read_line(fd, &ctl_line, &ctl_line_length, &term_pos, NULL); //TODO: support partial writes ctl_line[term_pos] ='\0'; parse_command(ctl_line); - + + GIOChannel *chan = NULL; + + if( (chan = g_io_channel_new_file((gchar *) fifo_path, "r+", NULL)) ) + g_io_add_watch(chan, G_IO_IN|G_IO_HUP, (GIOFunc) control_fifo, chan); + + return; } -- cgit v1.2.3 From 8ba87ad7653bff70bf44106dc1e3fe1d3e99d9f0 Mon Sep 17 00:00:00 2001 From: Barrucadu Date: Fri, 1 May 2009 15:04:44 +0100 Subject: Moved structs/function primitives to uzbl.h file, so we no longer need the growing collection of function primitives near the top of uzbl.c. Also tidied up a bit of the code a little. --- uzbl.c | 71 ++++++++++++------------------------------- uzbl.h | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 52 deletions(-) create mode 100644 uzbl.h (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 016f66a..eec7097 100644 --- a/uzbl.c +++ b/uzbl.c @@ -35,33 +35,34 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include -#include -#include #include #include #include #include -#include #include -#include -#include + +#include "uzbl.h" /* housekeeping / internal variables */ -static GtkWidget* main_window; -static GtkWidget* mainbar; -static GtkWidget* mainbar_label; +static GtkWidget* main_window; +static GtkWidget* mainbar; +static GtkWidget* mainbar_label; static WebKitWebView* web_view; -static gchar* main_title; -static gchar selected_url[500] = "\0"; -static gint load_progress; -static Window xwin = 0; -static char fifo_path[64]; -static char socket_path[108]; -static GString *keycmd; +static gchar* main_title; +static gchar selected_url[500] = "\0"; +static gint load_progress; +static Window xwin = 0; +static char fifo_path[64]; +static char socket_path[108]; +static GString* keycmd; /* state variables (initial values coming from command line arguments but may be changed later) */ static gchar* uri = NULL; @@ -82,15 +83,10 @@ static gchar* modkey = NULL; static guint modmask = 0; /* settings from config: group bindings, key -> action */ -static GHashTable *bindings; +static GHashTable* bindings; /* command list: name -> Command */ -static GHashTable *commands; - -typedef struct { - char *name; - char *param; -} Action; +static GHashTable* commands; /* commandline arguments (set initial values for the state variables) */ static GOptionEntry entries[] = @@ -107,35 +103,6 @@ typedef void (*Command)(WebKitWebView*, const char *); static char *XDG_CONFIG_HOME_default[256]; static char *XDG_CONFIG_DIRS_default = "/etc/xdg"; -static void -update_title(void); - -static void -load_uri ( WebKitWebView * web_view, const gchar * uri); - -static void -new_window_load_uri (const gchar * uri); - -static void -close_uzbl (WebKitWebView *page, const char *param); - -static gboolean -run_command(const char *command, const char *args); - -static void -spawn(WebKitWebView *web_view, const char *param); - -static void -free_action(gpointer action); - -static Action* -new_action(const gchar *name, const gchar *param); - -static void -set_insert_mode(WebKitWebView *page, const gchar *param); - - - /* --- CALLBACKS --- */ static gboolean @@ -728,7 +695,7 @@ settings_init () { modkey = g_key_file_get_value (config, "behavior", "modkey", NULL); status_top = g_key_file_get_boolean (config, "behavior", "status_top", NULL); if (! fifo_dir) - fifo_dir = g_key_file_get_value (config, "behavior", "fifodir", NULL); + fifo_dir = g_key_file_get_value (config, "behavior", "fifo_dir", NULL); if (! socket_dir) socket_dir = g_key_file_get_value (config, "behavior", "socket_dir", NULL); keys = g_key_file_get_keys (config, "bindings", NULL, NULL); diff --git a/uzbl.h b/uzbl.h new file mode 100644 index 0000000..7cd35c8 --- /dev/null +++ b/uzbl.h @@ -0,0 +1,106 @@ +typedef struct { + char* name; + char* param; +} Action; + + +static gboolean +new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *navigation_action, WebKitWebPolicyDecision *policy_decision, gpointer user_data); + +WebKitWebView* +create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data); + +static gboolean +download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data); + +static void +toggle_status_cb (WebKitWebView* page, const char *param); + +static void +link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpointer data); + +static void +title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data); + +static void +progress_change_cb (WebKitWebView* page, gint progress, gpointer data); + +static void +load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data); + +static void +destroy_cb (GtkWidget* widget, gpointer data); + +static void +log_history_cb (); + +static void +commands_hash(void); + +void +free_action(gpointer act); + +Action* +new_action(const gchar *name, const gchar *param); + +static bool +file_exists (const char * filename); + +void +set_insert_mode(WebKitWebView *page, const gchar *param); + +static void +load_uri (WebKitWebView * web_view, const gchar *param); + +static void +new_window_load_uri (const gchar * uri); + +static void +close_uzbl (WebKitWebView *page, const char *param); + +static gboolean +run_command(const char *command, const char *args); + +static void +spawn(WebKitWebView *web_view, const char *param); + +static void +parse_command(const char *cmd, const char *param); + +static void +parse_line(char *line); + +static void +control_fifo(GIOChannel *fd); + +static void +create_fifo(); + +static void +*control_socket(); + +static void +setup_threading (); + +static void +update_title (void); + +static gboolean +key_press_cb (WebKitWebView* page, GdkEventKey* event); + +static GtkWidget* +create_browser (); + +static GtkWidget* +create_mainbar (); + +static +GtkWidget* create_window (); + +static void +add_binding (const gchar *key, const gchar *act); + +static void +settings_init (); + +/* vi: set et ts=4: */ -- cgit v1.2.3