Cleanup and WebKit API update
This commit is contained in:
parent
54e03ab030
commit
e94d8c74e8
7 changed files with 90 additions and 103 deletions
|
@ -197,7 +197,9 @@ katze_throbber_init (KatzeThrobber *throbber)
|
|||
{
|
||||
GTK_WIDGET_SET_FLAGS (throbber, GTK_NO_WINDOW);
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
throbber->priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
priv->timer_id = -1;
|
||||
}
|
||||
|
||||
|
@ -205,7 +207,7 @@ static void
|
|||
katze_throbber_dispose (GObject *object)
|
||||
{
|
||||
KatzeThrobber* throbber = KATZE_THROBBER (object);
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
|
||||
if (G_UNLIKELY (priv->timer_id >= 0))
|
||||
g_source_remove (priv->timer_id);
|
||||
|
@ -217,7 +219,7 @@ static void
|
|||
katze_throbber_destroy (GtkObject *object)
|
||||
{
|
||||
KatzeThrobber* throbber = KATZE_THROBBER (object);
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
|
||||
katze_assign (priv->icon_name, NULL);
|
||||
if (priv->pixbuf)
|
||||
|
@ -335,7 +337,7 @@ katze_throbber_set_icon_size (KatzeThrobber* throbber,
|
|||
{
|
||||
g_return_if_fail (KATZE_IS_THROBBER (throbber));
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
g_return_if_fail (gtk_icon_size_lookup (icon_size,
|
||||
&priv->width,
|
||||
&priv->height));
|
||||
|
@ -360,7 +362,7 @@ katze_throbber_set_icon_name (KatzeThrobber* throbber,
|
|||
{
|
||||
g_return_if_fail (KATZE_IS_THROBBER (throbber));
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
katze_assign (priv->icon_name, g_strdup (icon_name));
|
||||
|
||||
if (icon_name)
|
||||
|
@ -387,7 +389,7 @@ katze_throbber_set_pixbuf (KatzeThrobber* throbber,
|
|||
g_return_if_fail (KATZE_IS_THROBBER (throbber));
|
||||
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
katze_object_assign (priv->pixbuf, pixbuf);
|
||||
|
||||
if (pixbuf)
|
||||
|
@ -415,7 +417,7 @@ katze_throbber_set_animated (KatzeThrobber* throbber,
|
|||
{
|
||||
g_return_if_fail (KATZE_IS_THROBBER (throbber));
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
if (G_UNLIKELY (priv->animated == animated))
|
||||
return;
|
||||
|
||||
|
@ -448,7 +450,7 @@ katze_throbber_set_static_icon_name (KatzeThrobber* throbber,
|
|||
{
|
||||
g_return_if_fail (KATZE_IS_THROBBER (throbber));
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
katze_assign (priv->static_icon_name, g_strdup (icon_name));
|
||||
|
||||
if (icon_name)
|
||||
|
@ -479,7 +481,7 @@ katze_throbber_set_static_pixbuf (KatzeThrobber* throbber,
|
|||
g_return_if_fail (KATZE_IS_THROBBER (throbber));
|
||||
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
katze_object_assign (priv->static_pixbuf, pixbuf);
|
||||
|
||||
if (pixbuf)
|
||||
|
@ -514,7 +516,7 @@ katze_throbber_set_static_stock_id (KatzeThrobber* throbber,
|
|||
g_return_if_fail (gtk_stock_lookup (stock_id, &stock_item));
|
||||
}
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
katze_assign (priv->static_stock_id, g_strdup (stock_id));
|
||||
|
||||
if (stock_id)
|
||||
|
@ -536,7 +538,7 @@ katze_throbber_get_icon_size (KatzeThrobber* throbber)
|
|||
{
|
||||
g_return_val_if_fail (KATZE_IS_THROBBER (throbber), GTK_ICON_SIZE_INVALID);
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
return priv->icon_size;
|
||||
}
|
||||
|
||||
|
@ -553,7 +555,7 @@ katze_throbber_get_icon_name (KatzeThrobber* throbber)
|
|||
{
|
||||
g_return_val_if_fail (KATZE_IS_THROBBER (throbber), NULL);
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
return priv->icon_name;
|
||||
}
|
||||
|
||||
|
@ -572,7 +574,7 @@ katze_throbber_get_pixbuf (KatzeThrobber* throbber)
|
|||
{
|
||||
g_return_val_if_fail (KATZE_IS_THROBBER (throbber), NULL);
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
return priv->pixbuf;
|
||||
}
|
||||
|
||||
|
@ -589,7 +591,7 @@ katze_throbber_get_animated (KatzeThrobber* throbber)
|
|||
{
|
||||
g_return_val_if_fail (KATZE_IS_THROBBER (throbber), FALSE);
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
return priv->animated;
|
||||
}
|
||||
|
||||
|
@ -607,7 +609,7 @@ katze_throbber_get_static_icon_name (KatzeThrobber* throbber)
|
|||
{
|
||||
g_return_val_if_fail (KATZE_IS_THROBBER (throbber), NULL);
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
return priv->static_icon_name;
|
||||
}
|
||||
|
||||
|
@ -626,7 +628,7 @@ katze_throbber_get_static_pixbuf (KatzeThrobber* throbber)
|
|||
{
|
||||
g_return_val_if_fail (KATZE_IS_THROBBER (throbber), NULL);
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
return priv->static_pixbuf;
|
||||
}
|
||||
|
||||
|
@ -644,7 +646,7 @@ katze_throbber_get_static_stock_id (KatzeThrobber* throbber)
|
|||
{
|
||||
g_return_val_if_fail (KATZE_IS_THROBBER (throbber), NULL);
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
return priv->static_stock_id;
|
||||
}
|
||||
|
||||
|
@ -662,7 +664,7 @@ katze_throbber_unrealize (GtkWidget* widget)
|
|||
if (GTK_WIDGET_CLASS (katze_throbber_parent_class)->unrealize)
|
||||
GTK_WIDGET_CLASS (katze_throbber_parent_class)->unrealize (widget);
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (KATZE_THROBBER (widget));
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER(widget)->priv;
|
||||
katze_object_assign (priv->pixbuf, NULL);
|
||||
katze_object_assign (priv->static_pixbuf, NULL);
|
||||
}
|
||||
|
@ -675,7 +677,7 @@ pixbuf_assign_icon (GdkPixbuf** pixbuf,
|
|||
if (*pixbuf)
|
||||
g_object_unref (*pixbuf);
|
||||
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
|
||||
GdkScreen* screen = gtk_widget_get_screen (GTK_WIDGET (throbber));
|
||||
GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen (screen);
|
||||
|
@ -689,7 +691,7 @@ pixbuf_assign_icon (GdkPixbuf** pixbuf,
|
|||
static void
|
||||
icon_theme_changed (KatzeThrobber* throbber)
|
||||
{
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
|
||||
if (priv->icon_name)
|
||||
pixbuf_assign_icon (&priv->pixbuf, priv->icon_name,
|
||||
|
@ -728,7 +730,7 @@ katze_throbber_unmap (GtkWidget* widget)
|
|||
static gboolean
|
||||
katze_throbber_timeout (KatzeThrobber* throbber)
|
||||
{
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
|
||||
priv->index++;
|
||||
gtk_widget_queue_draw (GTK_WIDGET (throbber));
|
||||
|
@ -739,7 +741,7 @@ katze_throbber_timeout (KatzeThrobber* throbber)
|
|||
static void
|
||||
katze_throbber_timeout_destroy (KatzeThrobber* throbber)
|
||||
{
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (throbber);
|
||||
KatzeThrobberPrivate* priv = throbber->priv;
|
||||
|
||||
priv->index = 0;
|
||||
priv->timer_id = -1;
|
||||
|
@ -772,7 +774,7 @@ static void
|
|||
katze_throbber_size_request (GtkWidget* widget,
|
||||
GtkRequisition* requisition)
|
||||
{
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (KATZE_THROBBER (widget));
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER (widget)->priv;
|
||||
|
||||
requisition->width = priv->width;
|
||||
requisition->height = priv->height;
|
||||
|
@ -785,7 +787,7 @@ static gboolean
|
|||
katze_throbber_expose_event (GtkWidget* widget,
|
||||
GdkEventExpose* event)
|
||||
{
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER_GET_PRIVATE (KATZE_THROBBER (widget));
|
||||
KatzeThrobberPrivate* priv = KATZE_THROBBER (widget)->priv;
|
||||
|
||||
if (G_UNLIKELY (!priv->width || !priv->height))
|
||||
return TRUE;
|
||||
|
|
|
@ -76,48 +76,47 @@ void on_action_edit_activate(GtkAction* action, CBrowser* browser)
|
|||
void on_action_cut_activate(GtkAction* action, CBrowser* browser)
|
||||
{
|
||||
GtkWidget* widget = gtk_window_get_focus(GTK_WINDOW(browser->window));
|
||||
if(G_UNLIKELY(!widget))
|
||||
return;
|
||||
if(G_LIKELY(widget))
|
||||
g_signal_emit_by_name(widget, "cut-clipboard");
|
||||
}
|
||||
|
||||
void on_action_copy_activate(GtkAction* action, CBrowser* browser)
|
||||
{
|
||||
GtkWidget* widget = gtk_window_get_focus(GTK_WINDOW(browser->window));
|
||||
if(G_UNLIKELY(!widget))
|
||||
return;
|
||||
if(G_LIKELY(widget))
|
||||
g_signal_emit_by_name(widget, "copy-clipboard");
|
||||
}
|
||||
|
||||
void on_action_paste_activate(GtkAction* action, CBrowser* browser)
|
||||
{
|
||||
GtkWidget* widget = gtk_window_get_focus(GTK_WINDOW(browser->window));
|
||||
if(G_UNLIKELY(!widget))
|
||||
return;
|
||||
if(G_LIKELY(widget))
|
||||
g_signal_emit_by_name(widget, "paste-clipboard");
|
||||
}
|
||||
|
||||
void on_action_delete_activate(GtkAction* action, CBrowser* browser)
|
||||
{
|
||||
GtkWidget* widget = gtk_window_get_focus(GTK_WINDOW(browser->window));
|
||||
if(G_UNLIKELY(!widget))
|
||||
return;
|
||||
if(G_LIKELY(widget))
|
||||
{
|
||||
if(WEBKIT_IS_WEB_VIEW(widget))
|
||||
webkit_web_view_delete_selection(WEBKIT_WEB_VIEW(widget));
|
||||
else if(GTK_IS_EDITABLE(widget))
|
||||
gtk_editable_delete_selection(GTK_EDITABLE(widget));
|
||||
}
|
||||
}
|
||||
|
||||
void on_action_selectAll_activate(GtkAction* action, CBrowser* browser)
|
||||
{
|
||||
GtkWidget* widget = gtk_window_get_focus(GTK_WINDOW(browser->window));
|
||||
if(G_UNLIKELY(!widget))
|
||||
return;
|
||||
if(G_LIKELY(widget))
|
||||
{
|
||||
if(GTK_IS_ENTRY(widget))
|
||||
gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1);
|
||||
else
|
||||
g_signal_emit_by_name(widget, "select-all");
|
||||
}
|
||||
}
|
||||
|
||||
void on_action_find_activate(GtkAction* action, CBrowser* browser)
|
||||
{
|
||||
|
@ -293,7 +292,7 @@ void on_action_source_view_activate(GtkAction* action, CBrowser* browser)
|
|||
|
||||
void on_action_back_activate(GtkAction* action, CBrowser* browser)
|
||||
{
|
||||
webkit_web_view_go_backward(WEBKIT_WEB_VIEW(get_nth_webView(-1, browser)));
|
||||
webkit_web_view_go_back(WEBKIT_WEB_VIEW(get_nth_webView(-1, browser)));
|
||||
}
|
||||
|
||||
void on_action_forward_activate(GtkAction* action, CBrowser* browser)
|
||||
|
@ -980,13 +979,13 @@ void on_action_panel_item_activate(GtkRadioAction* action
|
|||
void on_action_openInPanel_activate(GtkAction* action, CBrowser* browser)
|
||||
{
|
||||
GtkWidget* webView = get_nth_webView(-1, browser);
|
||||
g_free(config->panelPageholder);
|
||||
WebKitWebFrame* frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(webView));
|
||||
const gchar* uri = webkit_web_frame_get_uri(frame);
|
||||
config->panelPageholder = g_strdup(uri);
|
||||
katze_assign(config->panelPageholder, g_strdup(uri));
|
||||
GtkAction* action_pageholder =
|
||||
gtk_action_group_get_action(browser->actiongroup, "PanelPageholder");
|
||||
gint value; g_object_get(G_OBJECT(action_pageholder), "value", &value, NULL);
|
||||
gint value;
|
||||
g_object_get(G_OBJECT(action_pageholder), "value", &value, NULL);
|
||||
sokoke_radio_action_set_current_value(GTK_RADIO_ACTION(action_pageholder), value);
|
||||
gtk_widget_show(browser->panels);
|
||||
webView_open(browser->panel_pageholder, config->panelPageholder);
|
||||
|
@ -1061,8 +1060,8 @@ void on_notebook_switch_page(GtkWidget* widget, GtkNotebookPage* page
|
|||
static void on_window_size_allocate(GtkWidget* widget, GtkAllocation* allocation
|
||||
, CBrowser* browser)
|
||||
{
|
||||
if(!GTK_WIDGET_REALIZED(widget))
|
||||
return;
|
||||
if(GTK_WIDGET_REALIZED(widget))
|
||||
{
|
||||
if(!(gdk_window_get_state(widget->window)
|
||||
& (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)))
|
||||
{
|
||||
|
@ -1070,6 +1069,7 @@ static void on_window_size_allocate(GtkWidget* widget, GtkAllocation* allocation
|
|||
config->winHeight = allocation->height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gboolean on_window_destroy(GtkWidget* widget, GdkEvent* event, CBrowser* browser)
|
||||
{
|
||||
|
@ -1602,7 +1602,7 @@ CBrowser* browser_new(CBrowser* oldBrowser)
|
|||
gint page = gtk_notebook_get_current_page(GTK_NOTEBOOK(browser->webViews));
|
||||
page = gtk_notebook_insert_page(GTK_NOTEBOOK(browser->webViews)
|
||||
, scrolled, GTK_WIDGET(eventbox), page + 1);
|
||||
g_signal_connect_after(GTK_OBJECT(browser->webViews), "switch-page"
|
||||
g_signal_connect_after(browser->webViews, "switch-page"
|
||||
, G_CALLBACK(on_notebook_switch_page), browser);
|
||||
#if GTK_CHECK_VERSION(2, 10, 0)
|
||||
gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(browser->webViews), scrolled, TRUE);
|
||||
|
|
|
@ -138,7 +138,8 @@ gboolean spawn_protocol_command(const gchar* protocol, const gchar* res)
|
|||
show_error("Could not run external program.", error->message, NULL);
|
||||
g_error_free(error);
|
||||
}
|
||||
g_free(commandReady); g_free(uriEscaped);
|
||||
g_free(commandReady);
|
||||
g_free(uriEscaped);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -288,7 +289,6 @@ void action_set_active(const gchar* name, gboolean active, CBrowser* browser)
|
|||
{
|
||||
// This shortcut toggles activity state by an action name
|
||||
GtkAction* action = gtk_action_group_get_action(browser->actiongroup, name);
|
||||
g_return_if_fail(GTK_IS_ACTION(action));
|
||||
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), active);
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,6 @@ void action_set_sensitive(const gchar* name, gboolean sensitive, CBrowser* brows
|
|||
{
|
||||
// This shortcut toggles sensitivity by an action name
|
||||
GtkAction* action = gtk_action_group_get_action(browser->actiongroup, name);
|
||||
g_return_if_fail(GTK_IS_ACTION(action));
|
||||
gtk_action_set_sensitive(action, sensitive);
|
||||
}
|
||||
|
||||
|
@ -304,7 +303,6 @@ void action_set_visible(const gchar* name, gboolean visible, CBrowser* browser)
|
|||
{
|
||||
// This shortcut toggles visibility by an action name
|
||||
GtkAction* action = gtk_action_group_get_action(browser->actiongroup, name);
|
||||
g_return_if_fail(GTK_IS_ACTION(action));
|
||||
gtk_action_set_visible(action, visible);
|
||||
}
|
||||
|
||||
|
@ -360,7 +358,7 @@ void update_gui_state(CBrowser* browser)
|
|||
action_set_sensitive("ZoomIn", FALSE, browser);//webkit_web_view_can_increase_text_size(WEBKIT_WEB_VIEW(webView), browser);
|
||||
action_set_sensitive("ZoomOut", FALSE, browser);//webkit_web_view_can_decrease_text_size(WEBKIT_WEB_VIEW(webView)), browser);
|
||||
action_set_sensitive("ZoomNormal", FALSE, browser);//webkit_web_view_get_text_size(WEBKIT_WEB_VIEW(webView)) != 1, browser);
|
||||
action_set_sensitive("Back", webkit_web_view_can_go_backward(WEBKIT_WEB_VIEW(webView)), browser);
|
||||
action_set_sensitive("Back", webkit_web_view_can_go_back(WEBKIT_WEB_VIEW(webView)), browser);
|
||||
action_set_sensitive("Forward", webkit_web_view_can_go_forward(WEBKIT_WEB_VIEW(webView)), browser);
|
||||
action_set_sensitive("Refresh", browser->loadedPercent == -1, browser);
|
||||
action_set_sensitive("Stop", browser->loadedPercent != -1, browser);
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
static gboolean on_prefs_homepage_focus_out(GtkWidget* widget
|
||||
, GdkEventFocus event, CPrefs* prefs)
|
||||
{
|
||||
g_free(config->homepage);
|
||||
config->homepage = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
||||
katze_assign(config->homepage, g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -149,8 +148,7 @@ static void on_prefs_toolbarClosedTabs_toggled(GtkWidget* widget, CPrefs* prefs)
|
|||
static gboolean on_prefs_locationsearch_focus_out(GtkWidget* widget
|
||||
, GdkEventFocus event, CPrefs* prefs)
|
||||
{
|
||||
g_free(config->locationSearch);
|
||||
config->locationSearch = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
|
||||
katze_assign(config->locationSearch, g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -640,7 +638,7 @@ GtkWidget* prefs_preferences_dialog_new(CBrowser* browser)
|
|||
, (GtkTreeCellDataFunc)on_prefs_protocols_render_icon, prefs, NULL);
|
||||
renderer_text = gtk_cell_renderer_text_new();
|
||||
g_object_set(G_OBJECT(renderer_text), "editable", TRUE, NULL);
|
||||
g_signal_connect(GTK_OBJECT(renderer_text), "edited"
|
||||
g_signal_connect(renderer_text, "edited"
|
||||
, G_CALLBACK(on_prefs_protocols_edited), prefs);
|
||||
gtk_tree_view_column_pack_start(column, renderer_text, TRUE);
|
||||
gtk_tree_view_column_add_attribute(column, renderer_text, "text", PROTOCOLS_COL_COMMAND);
|
||||
|
|
26
src/search.c
26
src/search.c
|
@ -12,6 +12,7 @@
|
|||
#include "search.h"
|
||||
|
||||
#include "sokoke.h"
|
||||
#include "../katze/katze.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -86,13 +87,8 @@ gboolean search_engines_to_file(GList* searchEngines, const gchar* filename
|
|||
|
||||
SearchEngine* search_engine_new()
|
||||
{
|
||||
SearchEngine* engine = g_new(SearchEngine, 1);
|
||||
SearchEngine* engine = g_new0(SearchEngine, 1);
|
||||
engine->shortName = g_strdup("");
|
||||
engine->description = NULL;
|
||||
engine->url = NULL;
|
||||
engine->inputEncoding = NULL;
|
||||
engine->icon = NULL;
|
||||
engine->keyword = NULL;
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
@ -169,41 +165,35 @@ void search_engine_set_short_name(SearchEngine* engine, const gchar* shortName)
|
|||
{
|
||||
g_return_if_fail(engine);
|
||||
g_return_if_fail(shortName);
|
||||
g_free(engine->shortName);
|
||||
engine->shortName = g_strdup(shortName);
|
||||
katze_assign(engine->shortName, g_strdup(shortName));
|
||||
}
|
||||
|
||||
void search_engine_set_description(SearchEngine* engine, const gchar* description)
|
||||
{
|
||||
g_return_if_fail(engine);
|
||||
g_free(engine->description);
|
||||
engine->description = g_strdup(description);
|
||||
katze_assign(engine->description, g_strdup(description));
|
||||
}
|
||||
|
||||
void search_engine_set_url(SearchEngine* engine, const gchar* url)
|
||||
{
|
||||
g_return_if_fail(engine);
|
||||
g_free(engine->url);
|
||||
engine->url = g_strdup(url);
|
||||
katze_assign(engine->url, g_strdup(url));
|
||||
}
|
||||
|
||||
void search_engine_set_input_encoding(SearchEngine* engine, const gchar* inputEncoding)
|
||||
{
|
||||
g_return_if_fail(engine);
|
||||
g_free(engine->inputEncoding);
|
||||
engine->inputEncoding = g_strdup(inputEncoding);
|
||||
katze_assign(engine->inputEncoding, g_strdup(inputEncoding));
|
||||
}
|
||||
|
||||
void search_engine_set_icon(SearchEngine* engine, const gchar* icon)
|
||||
{
|
||||
g_return_if_fail(engine);
|
||||
g_free(engine->icon);
|
||||
engine->icon = g_strdup(icon);
|
||||
katze_assign(engine->icon, g_strdup(icon));
|
||||
}
|
||||
|
||||
void search_engine_set_keyword(SearchEngine* engine, const gchar* keyword)
|
||||
{
|
||||
g_return_if_fail(engine);
|
||||
g_free(engine->keyword);
|
||||
engine->keyword = g_strdup(keyword);
|
||||
katze_assign(engine->keyword, g_strdup(keyword));
|
||||
}
|
||||
|
|
|
@ -381,7 +381,9 @@ void sokoke_entry_set_can_undo(GtkEntry* entry, gboolean canUndo)
|
|||
}
|
||||
else
|
||||
{
|
||||
; // TODO: disconnect signal
|
||||
UNIMPLEMENTED
|
||||
g_signal_handlers_disconnect_by_func(entry
|
||||
, G_CALLBACK(sokoke_on_undo_entry_key_down), NULL);
|
||||
g_signal_handlers_disconnect_by_func(entry
|
||||
, G_CALLBACK(sokoke_on_undo_entry_populate_popup), NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,8 +95,7 @@ void on_webView_load_committed(GtkWidget* webView, WebKitWebFrame* frame
|
|||
{
|
||||
gtk_entry_set_text(GTK_ENTRY(browser->location), newUri);
|
||||
gtk_label_set_text(GTK_LABEL(browser->webView_name), newUri);
|
||||
g_free(browser->statusMessage);
|
||||
browser->statusMessage = NULL;
|
||||
katze_assign(browser->statusMessage, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,8 +117,7 @@ void on_webView_load_finished(GtkWidget* webView, WebKitWebFrame* widget
|
|||
|
||||
void on_webView_status_message(GtkWidget* webView, const gchar* text, CBrowser* browser)
|
||||
{
|
||||
g_free(browser->statusMessage);
|
||||
browser->statusMessage = g_strdup(text);
|
||||
katze_assign(browser->statusMessage, g_strdup(text));
|
||||
update_statusbar(browser);
|
||||
}
|
||||
|
||||
|
@ -137,11 +135,9 @@ gboolean on_webView_console_message(GtkWidget* webView
|
|||
void on_webView_link_hover(GtkWidget* webView, const gchar* tooltip
|
||||
, const gchar* uri, CBrowser* browser)
|
||||
{
|
||||
g_free(browser->statusMessage);
|
||||
browser->statusMessage = g_strdup(uri);
|
||||
katze_assign(browser->statusMessage, g_strdup(uri));
|
||||
update_statusbar(browser);
|
||||
g_free(browser->elementUri);
|
||||
browser->elementUri = g_strdup(uri);
|
||||
katze_assign(browser->elementUri, g_strdup(uri));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -215,7 +211,8 @@ gboolean on_webView_button_press(GtkWidget* webView, GdkEventButton* event
|
|||
switch(event->button)
|
||||
{
|
||||
case 1:
|
||||
if(!browser->elementUri) return FALSE;
|
||||
if(!browser->elementUri)
|
||||
return FALSE;
|
||||
if(state & GDK_SHIFT_MASK)
|
||||
{
|
||||
// Open link in new window
|
||||
|
@ -239,7 +236,8 @@ gboolean on_webView_button_press(GtkWidget* webView, GdkEventButton* event
|
|||
}
|
||||
else
|
||||
{
|
||||
if(!browser->elementUri) return FALSE;
|
||||
if(!browser->elementUri)
|
||||
return FALSE;
|
||||
// Open link in new tab
|
||||
CBrowser* curBrowser = browser_new(browser);
|
||||
webkit_web_view_open(WEBKIT_WEB_VIEW(curBrowser->webView), browser->elementUri);
|
||||
|
@ -279,8 +277,7 @@ gboolean on_webView_scroll(GtkWidget* webView, GdkEventScroll* event
|
|||
|
||||
gboolean on_webView_leave(GtkWidget* webView, GdkEventCrossing* event, CBrowser* browser)
|
||||
{
|
||||
g_free(browser->statusMessage);
|
||||
browser->statusMessage = NULL;
|
||||
katze_assign(browser->statusMessage, NULL);
|
||||
update_statusbar(browser);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -323,7 +320,7 @@ GtkWidget* webView_new(GtkWidget** scrolled)
|
|||
|
||||
void webView_open(GtkWidget* webView, const gchar* uri)
|
||||
{
|
||||
webkit_web_view_open(WEBKIT_WEB_VIEW(webView), (gchar*)uri);
|
||||
webkit_web_view_open(WEBKIT_WEB_VIEW(webView), uri);
|
||||
// We need to check the browser first
|
||||
// No browser means this is a panel
|
||||
CBrowser* browser = get_browser_from_webView(webView);
|
||||
|
|
Loading…
Reference in a new issue