Merge branch 'upstream-unstable'
This commit is contained in:
commit
aeae2420c6
68 changed files with 15204 additions and 10802 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,5 +1,16 @@
|
|||
This file is licensed under the terms of the expat license, see the file EXPAT.
|
||||
|
||||
v0.2.8
|
||||
+ Re-implement Bookmarks menu and toolbar button
|
||||
+ Show transferbar even if statusbar is hidden
|
||||
+ Smart case for inline search while typing
|
||||
+ Use Alt+Shift+Right instead of Ctrl+Right for Next Page
|
||||
+ Adding, edit and delete buttons for user scripts/ styles
|
||||
+ Rename 'Minimize Tab' to 'Show Tab Icon Only'
|
||||
+ Delete key in completion deletes items
|
||||
+ Don't show homepage in bookmarkbar
|
||||
+ Fix crash when using location arrow button
|
||||
|
||||
v0.2.7
|
||||
+ Multiple word completion in location
|
||||
+ Database backed bookmarks
|
||||
|
|
|
@ -1367,7 +1367,6 @@ adblock_activate_cb (MidoriExtension* extension,
|
|||
#endif
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
#if !HAVE_WEBKIT_RESOURCE_REQUEST
|
||||
SoupSession* session = webkit_get_default_session ();
|
||||
|
||||
|
@ -1391,8 +1390,7 @@ adblock_activate_cb (MidoriExtension* extension,
|
|||
adblock_reload_rules (extension, FALSE);
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
adblock_app_add_browser_cb (app, browser, extension);
|
||||
g_signal_connect (app, "add-browser",
|
||||
G_CALLBACK (adblock_app_add_browser_cb), extension);
|
||||
|
|
|
@ -99,6 +99,7 @@ midori_addons_button_add_clicked_cb (GtkToolItem* toolitem,
|
|||
gchar* addons_type;
|
||||
gchar* path;
|
||||
GtkWidget* dialog;
|
||||
GtkFileFilter* filter;
|
||||
|
||||
if (addons->kind == ADDONS_USER_SCRIPTS)
|
||||
{
|
||||
|
@ -115,17 +116,310 @@ midori_addons_button_add_clicked_cb (GtkToolItem* toolitem,
|
|||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
dialog = gtk_message_dialog_new (
|
||||
dialog = gtk_file_chooser_dialog_new (_("Choose file"),
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (addons))),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
|
||||
_("Copy %s to the folder %s."), addons_type, path);
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL,
|
||||
GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
|
||||
|
||||
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
|
||||
if (addons->kind == ADDONS_USER_SCRIPTS)
|
||||
{
|
||||
gtk_file_filter_set_name (filter, _("Userscripts"));
|
||||
gtk_file_filter_add_pattern (filter, "*.js");
|
||||
}
|
||||
else if (addons->kind == ADDONS_USER_STYLES)
|
||||
{
|
||||
gtk_file_filter_set_name (filter, _("Userstyles"));
|
||||
gtk_file_filter_add_pattern (filter, "*.css");
|
||||
}
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
|
||||
|
||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
GSList* files;
|
||||
|
||||
if (!g_file_test (path, G_FILE_TEST_EXISTS))
|
||||
katze_mkdir_with_parents (path, 0700);
|
||||
|
||||
#if !GTK_CHECK_VERSION (2, 14, 0)
|
||||
files = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (dialog));
|
||||
#else
|
||||
files = gtk_file_chooser_get_files (GTK_FILE_CHOOSER (dialog));
|
||||
#endif
|
||||
|
||||
while (files)
|
||||
{
|
||||
GFile* src_file;
|
||||
GError* error = NULL;
|
||||
|
||||
#if !GTK_CHECK_VERSION (2, 14, 0)
|
||||
src_file = g_file_new_for_path (files);
|
||||
#else
|
||||
src_file = files->data;
|
||||
#endif
|
||||
|
||||
if (G_IS_FILE (src_file))
|
||||
{
|
||||
GFile* dest_file;
|
||||
gchar* dest_file_path;
|
||||
|
||||
dest_file_path = g_build_path (G_DIR_SEPARATOR_S, path,
|
||||
g_file_get_basename (src_file), NULL);
|
||||
|
||||
dest_file = g_file_new_for_path (dest_file_path);
|
||||
|
||||
g_file_copy (src_file, dest_file,
|
||||
G_FILE_COPY_OVERWRITE | G_FILE_COPY_BACKUP,
|
||||
NULL, NULL, NULL, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
GtkWidget* msg_box;
|
||||
msg_box = gtk_message_dialog_new (
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (addons))),
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
"%s", error->message);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (msg_box), _("Error"));
|
||||
gtk_dialog_run (GTK_DIALOG (msg_box));
|
||||
gtk_widget_destroy (msg_box);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_object_unref (src_file);
|
||||
g_object_unref (dest_file);
|
||||
g_free (dest_file_path);
|
||||
}
|
||||
files = g_slist_next (files);
|
||||
}
|
||||
g_slist_free (files);
|
||||
}
|
||||
|
||||
g_free (addons_type);
|
||||
g_free (path);
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_addons_button_delete_clicked_cb (GtkWidget* toolitem,
|
||||
Addons* addons)
|
||||
{
|
||||
GtkTreeModel* model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (addons->treeview),
|
||||
&model, &iter))
|
||||
{
|
||||
struct AddonElement* element;
|
||||
gint delete_response;
|
||||
GtkWidget* dialog;
|
||||
|
||||
gtk_tree_model_get (model, &iter, 0, &element, -1);
|
||||
dialog = gtk_message_dialog_new (
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (addons))),
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_CANCEL,
|
||||
_("Do you want to delete '%s'?"),
|
||||
element->displayname);
|
||||
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_DELETE, GTK_RESPONSE_YES);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (dialog),
|
||||
addons->kind == ADDONS_USER_SCRIPTS
|
||||
? _("Delete user script")
|
||||
: _("Delete user style"));
|
||||
|
||||
gtk_message_dialog_format_secondary_markup (
|
||||
GTK_MESSAGE_DIALOG (dialog),
|
||||
_("The file <b>%s</b> will be permanently deleted."),
|
||||
element->fullpath);
|
||||
|
||||
delete_response = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
|
||||
if (delete_response == GTK_RESPONSE_YES)
|
||||
{
|
||||
GError* error = NULL;
|
||||
GFile* file;
|
||||
gboolean result;
|
||||
|
||||
file = g_file_new_for_path (element->fullpath);
|
||||
result = g_file_delete (file, NULL, &error);
|
||||
|
||||
if (!result && error)
|
||||
{
|
||||
GtkWidget* msg_box;
|
||||
msg_box = gtk_message_dialog_new (
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (addons))),
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
"%s", error->message);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (msg_box), _("Error"));
|
||||
gtk_dialog_run (GTK_DIALOG (msg_box));
|
||||
gtk_widget_destroy (msg_box);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
if (result)
|
||||
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
|
||||
|
||||
g_object_unref (file);
|
||||
}
|
||||
}
|
||||
}
|
||||
static void
|
||||
midori_addons_open_in_editor_clicked_cb (GtkWidget* toolitem,
|
||||
Addons* addons)
|
||||
{
|
||||
GtkTreeModel* model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (addons->treeview),
|
||||
&model, &iter))
|
||||
{
|
||||
struct AddonElement* element;
|
||||
MidoriWebSettings* settings;
|
||||
MidoriBrowser* browser;
|
||||
gchar* text_editor;
|
||||
gchar* element_uri;
|
||||
|
||||
browser = midori_browser_get_for_widget (GTK_WIDGET (addons->treeview));
|
||||
settings = katze_object_get_object (browser, "settings");
|
||||
|
||||
gtk_tree_model_get (model, &iter, 0, &element, -1);
|
||||
element_uri = g_filename_to_uri (element->fullpath, NULL, NULL);
|
||||
|
||||
g_object_get (settings, "text-editor", &text_editor, NULL);
|
||||
if (text_editor && *text_editor)
|
||||
sokoke_spawn_program (text_editor, element_uri, TRUE);
|
||||
else
|
||||
sokoke_show_uri (NULL, element_uri,
|
||||
gtk_get_current_event_time (), NULL);
|
||||
|
||||
g_free (element_uri);
|
||||
g_free (text_editor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
midori_addons_open_target_folder_clicked_cb (GtkWidget* toolitem,
|
||||
Addons* addons)
|
||||
{
|
||||
GtkTreeModel* model;
|
||||
GtkTreeIter iter;
|
||||
gchar* folder;
|
||||
gchar* folder_uri;
|
||||
|
||||
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (addons->treeview),
|
||||
&model, &iter))
|
||||
{
|
||||
struct AddonElement* element;
|
||||
|
||||
gtk_tree_model_get (model, &iter, 0, &element, -1);
|
||||
folder = g_path_get_dirname (element->fullpath);
|
||||
}
|
||||
else
|
||||
folder = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (),
|
||||
PACKAGE_NAME,
|
||||
addons->kind == ADDONS_USER_SCRIPTS
|
||||
? "scripts" : "styles", NULL);
|
||||
folder_uri = g_filename_to_uri (folder, NULL, NULL);
|
||||
g_free (folder);
|
||||
|
||||
sokoke_show_uri (gtk_widget_get_screen (GTK_WIDGET (addons->treeview)),
|
||||
folder_uri, gtk_get_current_event_time (), NULL);
|
||||
g_free (folder_uri);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_addons_popup_item (GtkMenu* menu,
|
||||
const gchar* stock_id,
|
||||
const gchar* label,
|
||||
struct AddonElement* element,
|
||||
gpointer callback,
|
||||
Addons* addons)
|
||||
{
|
||||
GtkWidget* menuitem;
|
||||
|
||||
menuitem = gtk_image_menu_item_new_from_stock (stock_id, NULL);
|
||||
if (label)
|
||||
gtk_label_set_text_with_mnemonic (GTK_LABEL (gtk_bin_get_child (
|
||||
GTK_BIN (menuitem))), label);
|
||||
if (!strcmp (stock_id, GTK_STOCK_EDIT))
|
||||
gtk_widget_set_sensitive (menuitem, element->fullpath !=NULL);
|
||||
else if (strcmp (stock_id, GTK_STOCK_DELETE))
|
||||
gtk_widget_set_sensitive (menuitem, element->fullpath !=NULL);
|
||||
g_object_set_data (G_OBJECT (menuitem), "AddonElement", &element);
|
||||
g_signal_connect (menuitem, "activate", G_CALLBACK(callback), addons);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_addons_popup (GtkWidget* widget,
|
||||
GdkEventButton* event,
|
||||
struct AddonElement* element,
|
||||
Addons* addons)
|
||||
{
|
||||
GtkWidget* menu;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
midori_addons_popup_item (GTK_MENU (menu), GTK_STOCK_EDIT, _("Open in Text Editor"),
|
||||
element, midori_addons_open_in_editor_clicked_cb, addons);
|
||||
midori_addons_popup_item (GTK_MENU (menu), GTK_STOCK_OPEN, _("Open Target Folder"),
|
||||
element, midori_addons_open_target_folder_clicked_cb, addons);
|
||||
midori_addons_popup_item (GTK_MENU (menu), GTK_STOCK_DELETE, NULL,
|
||||
element, midori_addons_button_delete_clicked_cb, addons);
|
||||
katze_widget_popup (widget, GTK_MENU (menu), event, KATZE_MENU_POSITION_CURSOR);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
midori_addons_popup_menu_cb (GtkWidget *widget,
|
||||
Addons* addons)
|
||||
{
|
||||
GtkTreeModel* model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
|
||||
{
|
||||
struct AddonElement* element;
|
||||
gtk_tree_model_get (model, &iter, 0, &element, -1);
|
||||
midori_addons_popup (widget, NULL, element, addons);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
midori_addons_button_release_event_cb (GtkWidget* widget,
|
||||
GdkEventButton* event,
|
||||
Addons* addons)
|
||||
{
|
||||
GtkTreeModel* model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (event->button != 3)
|
||||
return FALSE;
|
||||
if (katze_tree_view_get_selected_iter (GTK_TREE_VIEW (widget), &model, &iter))
|
||||
{
|
||||
struct AddonElement* element;
|
||||
gtk_tree_model_get (model, &iter, 0, &element, -1);
|
||||
midori_addons_popup (widget, NULL, element, addons);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
addons_get_toolbar (MidoriViewable* viewable)
|
||||
{
|
||||
|
@ -137,27 +431,46 @@ addons_get_toolbar (MidoriViewable* viewable)
|
|||
if (!ADDONS (viewable)->toolbar)
|
||||
{
|
||||
toolbar = gtk_toolbar_new ();
|
||||
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
|
||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
|
||||
toolitem = gtk_tool_item_new ();
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
|
||||
/* separator */
|
||||
toolitem = gtk_separator_tool_item_new ();
|
||||
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (toolitem),
|
||||
FALSE);
|
||||
gtk_tool_item_set_expand (toolitem, TRUE);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
|
||||
/* add button */
|
||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_ADD);
|
||||
gtk_tool_item_set_is_important (toolitem, TRUE);
|
||||
g_signal_connect (toolitem, "clicked",
|
||||
G_CALLBACK (midori_addons_button_add_clicked_cb), viewable);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem), _("Add new addon"));
|
||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
|
||||
/* Text editor button */
|
||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_EDIT);
|
||||
g_signal_connect (toolitem, "clicked",
|
||||
G_CALLBACK (midori_addons_open_in_editor_clicked_cb), viewable);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
|
||||
_("Open in Text Editor"));
|
||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
|
||||
/* Target folder button */
|
||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DIRECTORY);
|
||||
g_signal_connect (toolitem, "clicked",
|
||||
G_CALLBACK (midori_addons_open_target_folder_clicked_cb), viewable);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
|
||||
_("Open Target Folder"));
|
||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
|
||||
/* Delete button */
|
||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_DELETE);
|
||||
g_signal_connect (toolitem, "clicked",
|
||||
G_CALLBACK (midori_addons_button_delete_clicked_cb), viewable);
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem),
|
||||
_("Open target folder for selected addon"));
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (toolitem), _("Remove selected addon"));
|
||||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
ADDONS (viewable)->toolbar = toolbar;
|
||||
|
||||
|
@ -358,7 +671,6 @@ addons_get_files (AddonsKind kind)
|
|||
{
|
||||
GSList* files;
|
||||
GDir* addon_dir;
|
||||
GSList* list;
|
||||
GSList* directories;
|
||||
const gchar* filename;
|
||||
gchar* dirname;
|
||||
|
@ -375,7 +687,6 @@ addons_get_files (AddonsKind kind)
|
|||
files = NULL;
|
||||
|
||||
directories = addons_get_directories (kind);
|
||||
list = directories;
|
||||
while (directories)
|
||||
{
|
||||
dirname = directories->data;
|
||||
|
@ -395,7 +706,6 @@ addons_get_files (AddonsKind kind)
|
|||
directories = g_slist_next (directories);
|
||||
}
|
||||
|
||||
g_slist_free (list);
|
||||
g_free (file_extension);
|
||||
|
||||
return files;
|
||||
|
@ -671,8 +981,9 @@ addons_update_elements (MidoriExtension* extension,
|
|||
if (liststore)
|
||||
gtk_list_store_clear (liststore);
|
||||
else
|
||||
liststore = gtk_list_store_new (3, G_TYPE_POINTER,
|
||||
liststore = gtk_list_store_new (4, G_TYPE_POINTER,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING);
|
||||
|
||||
keyfile = g_key_file_new ();
|
||||
|
@ -686,6 +997,9 @@ addons_update_elements (MidoriExtension* extension,
|
|||
elements = NULL;
|
||||
while (addon_files)
|
||||
{
|
||||
gchar* filename;
|
||||
gchar* tooltip;
|
||||
|
||||
fullpath = addon_files->data;
|
||||
element = g_new (struct AddonElement, 1);
|
||||
element->displayname = g_filename_display_basename (fullpath);
|
||||
|
@ -732,10 +1046,22 @@ addons_update_elements (MidoriExtension* extension,
|
|||
element->enabled = FALSE;
|
||||
}
|
||||
|
||||
filename = g_path_get_basename (element->fullpath);
|
||||
if (element->description)
|
||||
{
|
||||
tooltip = g_strdup_printf ("%s\n\n%s",
|
||||
filename, element->description);
|
||||
g_free (filename);
|
||||
}
|
||||
else
|
||||
tooltip = filename;
|
||||
|
||||
gtk_list_store_append (liststore, &iter);
|
||||
gtk_list_store_set (liststore, &iter,
|
||||
0, element, 1, 0, 2, "", -1);
|
||||
0, element, 1, 0, 2, element->fullpath,
|
||||
3, tooltip, -1);
|
||||
|
||||
g_free (tooltip);
|
||||
addon_files = g_slist_next (addon_files);
|
||||
elements = g_slist_prepend (elements, element);
|
||||
}
|
||||
|
@ -780,9 +1106,16 @@ addons_init (Addons* addons)
|
|||
(GtkTreeCellDataFunc)addons_treeview_render_text_cb,
|
||||
addons->treeview, NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (addons->treeview), column);
|
||||
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (addons->treeview), 3);
|
||||
g_signal_connect (addons->treeview, "row-activated",
|
||||
G_CALLBACK (addons_treeview_row_activated_cb),
|
||||
addons);
|
||||
g_signal_connect (addons->treeview, "button-release-event",
|
||||
G_CALLBACK (midori_addons_button_release_event_cb),
|
||||
addons);
|
||||
g_signal_connect (addons->treeview, "popup-menu",
|
||||
G_CALLBACK (midori_addons_popup_menu_cb),
|
||||
addons);
|
||||
gtk_widget_show (addons->treeview);
|
||||
gtk_box_pack_start (GTK_BOX (addons), addons->treeview, TRUE, TRUE, 0);
|
||||
}
|
||||
|
@ -907,6 +1240,7 @@ addons_context_ready_cb (WebKitWebView* web_view,
|
|||
GSList* scripts, *styles;
|
||||
struct AddonElement* script, *style;
|
||||
struct AddonsList* scripts_list, *styles_list;
|
||||
|
||||
uri = katze_object_get_string (web_view, "uri");
|
||||
/* Don't run scripts or styles on blank or special pages */
|
||||
if (!(uri && *uri && strncmp (uri, "about:", 6)))
|
||||
|
@ -944,6 +1278,7 @@ addons_context_ready_cb (WebKitWebView* web_view,
|
|||
webkit_web_view_execute_script (web_view, style->script_content);
|
||||
styles = g_slist_next (styles);
|
||||
}
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1112,13 +1447,12 @@ addons_deactivate_cb (MidoriExtension* extension,
|
|||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
GSource* source;
|
||||
guint i = 0;
|
||||
|
||||
addons_disable_monitors (extension);
|
||||
addons_save_settings (NULL, extension);
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
addons_browser_destroy (browser, extension);
|
||||
|
||||
source = g_object_get_data (G_OBJECT (extension), "monitor-timer");
|
||||
|
@ -1179,7 +1513,6 @@ addons_monitor_directories (MidoriExtension* extension,
|
|||
AddonsKind kind)
|
||||
{
|
||||
GSList* directories;
|
||||
GSList* list;
|
||||
GError* error;
|
||||
GSList* monitors;
|
||||
GFileMonitor* monitor;
|
||||
|
@ -1190,7 +1523,6 @@ addons_monitor_directories (MidoriExtension* extension,
|
|||
monitors = g_object_get_data (G_OBJECT (extension), "monitors");
|
||||
|
||||
directories = addons_get_directories (kind);
|
||||
list = directories;
|
||||
while (directories)
|
||||
{
|
||||
directory = g_file_new_for_path (directories->data);
|
||||
|
@ -1223,16 +1555,14 @@ addons_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
addons_update_elements (extension, ADDONS_USER_STYLES);
|
||||
addons_monitor_directories (extension, ADDONS_USER_STYLES);
|
||||
addons_update_elements (extension, ADDONS_USER_SCRIPTS);
|
||||
addons_monitor_directories (extension, ADDONS_USER_STYLES);
|
||||
addons_monitor_directories (extension, ADDONS_USER_SCRIPTS);
|
||||
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
addons_app_add_browser_cb (app, browser, extension);
|
||||
g_object_unref (browsers);
|
||||
|
||||
|
|
|
@ -185,11 +185,9 @@ colorful_tabs_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
colorful_tabs_app_add_browser_cb (app, browser, extension);
|
||||
g_signal_connect (app, "add-browser",
|
||||
G_CALLBACK (colorful_tabs_app_add_browser_cb), extension);
|
||||
|
|
|
@ -315,7 +315,6 @@ CookieManager *cookie_manager_new(MidoriExtension *extension, MidoriApp *app)
|
|||
{
|
||||
CookieManager *cm;
|
||||
CookieManagerPrivate *priv;
|
||||
guint i;
|
||||
KatzeArray *browsers;
|
||||
MidoriBrowser *browser;
|
||||
|
||||
|
@ -327,8 +326,7 @@ CookieManager *cookie_manager_new(MidoriExtension *extension, MidoriApp *app)
|
|||
|
||||
/* add the cookie manager panel page to existing browsers */
|
||||
browsers = katze_object_get_object(app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item(browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
cookie_manager_app_add_browser_cb(app, browser, cm);
|
||||
g_object_unref(browsers);
|
||||
|
||||
|
|
|
@ -80,11 +80,9 @@ copy_tabs_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
copy_tabs_app_add_browser_cb (app, browser, extension);
|
||||
g_object_unref (browsers);
|
||||
g_signal_connect (app, "add-browser",
|
||||
|
|
|
@ -271,7 +271,6 @@ feed_panel_disconnect_feed (FeedPanel* panel,
|
|||
KatzeArray* feed)
|
||||
{
|
||||
KatzeItem* item;
|
||||
guint i;
|
||||
|
||||
g_return_if_fail (KATZE_IS_ARRAY (feed));
|
||||
|
||||
|
@ -282,8 +281,7 @@ feed_panel_disconnect_feed (FeedPanel* panel,
|
|||
g_signal_handlers_disconnect_by_func (feed,
|
||||
feed_panel_move_item_cb, panel);
|
||||
|
||||
i = 0;
|
||||
while ((item = katze_array_get_nth_item (feed, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, feed)
|
||||
{
|
||||
if (KATZE_IS_ARRAY (item))
|
||||
feed_panel_disconnect_feed (panel, KATZE_ARRAY (item));
|
||||
|
|
|
@ -157,18 +157,18 @@ feed_save_items (MidoriExtension* extension,
|
|||
{
|
||||
KatzeItem* item;
|
||||
gchar** sfeeds;
|
||||
gint i;
|
||||
gint n;
|
||||
gint i, n;
|
||||
|
||||
g_return_if_fail (KATZE_IS_ARRAY (feed));
|
||||
|
||||
n = katze_array_get_length (feed);
|
||||
sfeeds = g_new (gchar*, n + 1);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
i = 0;
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, feed)
|
||||
{
|
||||
item = katze_array_get_nth_item (feed, i);
|
||||
sfeeds[i] = (gchar*) katze_item_get_uri (KATZE_ITEM (item));
|
||||
i++;
|
||||
}
|
||||
sfeeds[n] = NULL;
|
||||
|
||||
|
@ -336,7 +336,11 @@ secondary_icon_released_cb (GtkAction* action,
|
|||
|
||||
if ((feed = feed_add_item (priv->feeds, uri)))
|
||||
{
|
||||
/* FIXME: Let the user know that a feed was added */
|
||||
MidoriPanel* panel = katze_object_get_object (priv->browser, "panel");
|
||||
gint i = midori_panel_page_num (panel, priv->panel);
|
||||
midori_panel_set_current_page (panel, i);
|
||||
gtk_widget_show (GTK_WIDGET (panel));
|
||||
g_object_unref (panel);
|
||||
feed_save_items (priv->extension, priv->feeds);
|
||||
update_feed (priv, KATZE_ITEM (feed));
|
||||
return TRUE;
|
||||
|
@ -494,11 +498,9 @@ feed_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
feed_app_add_browser_cb (app, browser, extension);
|
||||
g_object_unref (browsers);
|
||||
|
||||
|
|
|
@ -425,7 +425,6 @@ formhistory_activate_cb (MidoriExtension* extension,
|
|||
char* errmsg = NULL, *errmsg2 = NULL;
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
global_keys = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify)g_free,
|
||||
|
@ -464,8 +463,7 @@ formhistory_activate_cb (MidoriExtension* extension,
|
|||
}
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
formhistory_app_add_browser_cb (app, browser, extension);
|
||||
g_signal_connect (app, "add-browser",
|
||||
G_CALLBACK (formhistory_app_add_browser_cb), extension);
|
||||
|
|
|
@ -281,14 +281,12 @@ mouse_gestures_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
gesture = mouse_gesture_new ();
|
||||
gesture->button = midori_extension_get_integer (extension, "button");
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
mouse_gestures_app_add_browser_cb (app, browser, extension);
|
||||
g_signal_connect (app, "add-browser",
|
||||
G_CALLBACK (mouse_gestures_app_add_browser_cb), extension);
|
||||
|
|
|
@ -139,11 +139,9 @@ page_holder_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
page_holder_app_add_browser_cb (app, browser, extension);
|
||||
g_object_unref (browsers);
|
||||
g_signal_connect (app, "add-browser",
|
||||
|
|
|
@ -297,11 +297,9 @@ shortcuts_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
shortcuts_app_add_browser_cb (app, browser, extension);
|
||||
g_signal_connect (app, "add-browser",
|
||||
G_CALLBACK (shortcuts_app_add_browser_cb), extension);
|
||||
|
|
|
@ -131,10 +131,9 @@ clock_deactivate_cb (MidoriExtension* extension,
|
|||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
GtkWidget* label;
|
||||
guint i = 0;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
{
|
||||
clock_browser_destroy_cb (browser, NULL);
|
||||
label = g_object_get_data (G_OBJECT (browser), "clock-label");
|
||||
|
@ -155,10 +154,9 @@ clock_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i = 0;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
clock_app_add_browser_cb (app, browser, extension);
|
||||
g_signal_connect (app, "add-browser",
|
||||
G_CALLBACK (clock_app_add_browser_cb), extension);
|
||||
|
|
|
@ -131,11 +131,9 @@ statusbar_features_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
statusbar_features_app_add_browser_cb (app, browser, extension);
|
||||
g_signal_connect (app, "add-browser",
|
||||
G_CALLBACK (statusbar_features_app_add_browser_cb), extension);
|
||||
|
|
|
@ -498,6 +498,7 @@ tab_panel_app_add_browser_cb (MidoriApp* app,
|
|||
GtkCellRenderer* renderer_text;
|
||||
GtkWidget* panel;
|
||||
GtkWidget* toolbar;
|
||||
gint i;
|
||||
/* GtkToolItem* toolitem; */
|
||||
|
||||
g_object_set (browser, "show-tabs", FALSE, NULL);
|
||||
|
@ -564,8 +565,10 @@ tab_panel_app_add_browser_cb (MidoriApp* app,
|
|||
gtk_widget_show (GTK_WIDGET (toolitem));
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1); */
|
||||
|
||||
midori_panel_append_widget (MIDORI_PANEL (panel), treeview,
|
||||
i = midori_panel_append_widget (MIDORI_PANEL (panel), treeview,
|
||||
STOCK_TAB_PANEL, _("Tab Panel"), toolbar);
|
||||
if (gtk_widget_get_visible (GTK_WIDGET (browser)))
|
||||
midori_panel_set_current_page (MIDORI_PANEL (panel), i);
|
||||
g_object_unref (panel);
|
||||
|
||||
midori_browser_foreach (browser,
|
||||
|
@ -587,11 +590,9 @@ tab_panel_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
tab_panel_app_add_browser_cb (app, browser, extension);
|
||||
g_object_unref (browsers);
|
||||
g_signal_connect (app, "add-browser",
|
||||
|
|
|
@ -61,11 +61,9 @@ tabs_minimized_activate_cb (MidoriExtension* extension,
|
|||
{
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
tabs_minimized_app_add_browser_cb (app, browser, extension);
|
||||
g_object_unref (browsers);
|
||||
g_signal_connect (app, "add-browser",
|
||||
|
@ -76,8 +74,8 @@ MidoriExtension*
|
|||
extension_init (void)
|
||||
{
|
||||
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
|
||||
"name", _("Minimize new Tabs"),
|
||||
"description", _("New tabs open minimized"),
|
||||
"name", _("Only Icons on Tabs by default"),
|
||||
"description", _("New tabs have no label by default"),
|
||||
"version", "0.1",
|
||||
"authors", "MonkeyOfDoom <pixelmonkey@ensellitis.com>",
|
||||
NULL);
|
||||
|
|
|
@ -592,11 +592,9 @@ static void tb_editor_activate_cb(MidoriExtension *extension, MidoriApp *app)
|
|||
{
|
||||
KatzeArray *browsers;
|
||||
MidoriBrowser *browser;
|
||||
guint i;
|
||||
|
||||
browsers = katze_object_get_object(app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item(browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
tb_editor_app_add_browser_cb(app, browser, extension);
|
||||
g_signal_connect(app, "add-browser", G_CALLBACK(tb_editor_app_add_browser_cb), extension);
|
||||
g_object_unref(browsers);
|
||||
|
|
|
@ -438,7 +438,6 @@ web_cache_activate_cb (MidoriExtension* extension,
|
|||
const gchar* cache_path = midori_extension_get_string (extension, "path");
|
||||
KatzeArray* browsers;
|
||||
MidoriBrowser* browser;
|
||||
guint i;
|
||||
SoupSession* session = webkit_get_default_session ();
|
||||
|
||||
katze_mkdir_with_parents (cache_path, 0700);
|
||||
|
@ -446,8 +445,7 @@ web_cache_activate_cb (MidoriExtension* extension,
|
|||
G_CALLBACK (web_cache_session_request_queued_cb), extension);
|
||||
|
||||
browsers = katze_object_get_object (app, "browsers");
|
||||
i = 0;
|
||||
while ((browser = katze_array_get_nth_item (browsers, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (browser, browsers)
|
||||
web_cache_app_add_browser_cb (app, browser, extension);
|
||||
g_signal_connect (app, "add-browser",
|
||||
G_CALLBACK (web_cache_app_add_browser_cb), extension);
|
||||
|
|
|
@ -479,6 +479,12 @@ katze_array_get_items (KatzeArray* array)
|
|||
return g_list_copy (array->items);
|
||||
}
|
||||
|
||||
GList*
|
||||
katze_array_peek_items (KatzeArray* array)
|
||||
{
|
||||
return array->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* katze_array_clear:
|
||||
* @array: a #KatzeArray
|
||||
|
|
|
@ -80,6 +80,17 @@ katze_array_move_item (KatzeArray* array,
|
|||
GList*
|
||||
katze_array_get_items (KatzeArray* array);
|
||||
|
||||
GList*
|
||||
katze_array_peek_items (KatzeArray* array);
|
||||
|
||||
GList* kalistglobal;
|
||||
#define KATZE_ARRAY_FOREACH_ITEM(kaitem, kaarray) \
|
||||
for (kalistglobal = katze_array_peek_items (kaarray), \
|
||||
kaitem = kalistglobal ? kalistglobal->data : NULL; \
|
||||
kalistglobal != NULL; \
|
||||
kalistglobal = g_list_next (kalistglobal), \
|
||||
kaitem = kalistglobal ? kalistglobal->data : NULL)
|
||||
|
||||
void
|
||||
katze_array_clear (KatzeArray* array);
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ enum
|
|||
enum
|
||||
{
|
||||
POPULATE_POPUP,
|
||||
POPULATE_FOLDER,
|
||||
ACTIVATE_ITEM,
|
||||
ACTIVATE_ITEM_ALT,
|
||||
LAST_SIGNAL
|
||||
|
@ -104,6 +105,43 @@ katze_array_action_class_init (KatzeArrayActionClass* class)
|
|||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_MENU);
|
||||
|
||||
/**
|
||||
* KatzeArrayAction::populate-folder:
|
||||
* @array: the object on which the signal is emitted
|
||||
* @menu: the menu shell being opened
|
||||
* @folder: the folder being opened
|
||||
*
|
||||
* A context menu is going to be opened for @folder,
|
||||
* the provided @menu can be populated accordingly.
|
||||
*
|
||||
* Unlike "populate-popup" this signal is emitted for
|
||||
* the toplevel folder and all subfolders.
|
||||
*
|
||||
* Return value: %TRUE if the event was handled. If %FALSE is returned,
|
||||
* the default "populate-popup" signal is emitted.
|
||||
*
|
||||
* Since: 0.2.8
|
||||
**/
|
||||
|
||||
signals[POPULATE_FOLDER] = g_signal_new ("populate-folder",
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
(GSignalFlags) (G_SIGNAL_RUN_LAST),
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
midori_cclosure_marshal_BOOLEAN__OBJECT_OBJECT,
|
||||
G_TYPE_BOOLEAN, 2,
|
||||
GTK_TYPE_MENU_SHELL, KATZE_TYPE_ITEM);
|
||||
|
||||
/**
|
||||
* KatzeArrayAction::activate-item:
|
||||
* @array: the object on which the signal is emitted
|
||||
* @item: the item being activated
|
||||
*
|
||||
* An item was clicked with the first button.
|
||||
*
|
||||
* Deprecated: 0.2.8: Use "activate-item-alt" instead.
|
||||
**/
|
||||
signals[ACTIVATE_ITEM] = g_signal_new ("activate-item",
|
||||
G_TYPE_FROM_CLASS (class),
|
||||
(GSignalFlags) (G_SIGNAL_RUN_LAST),
|
||||
|
@ -120,8 +158,7 @@ katze_array_action_class_init (KatzeArrayActionClass* class)
|
|||
* @item: the item being activated
|
||||
* @button: the mouse button pressed
|
||||
*
|
||||
* An item was clicked with a particular button. Use this if you need
|
||||
* to handle middle or right clicks specially.
|
||||
* An item was clicked, with the specified @button.
|
||||
*
|
||||
* Return value: %TRUE if the event was handled. If %FALSE is returned,
|
||||
* the default "activate-item" signal is emitted.
|
||||
|
@ -257,12 +294,24 @@ katze_array_action_activate (GtkAction* action)
|
|||
GTK_ACTION_CLASS (katze_array_action_parent_class)->activate (action);
|
||||
}
|
||||
|
||||
static void
|
||||
katze_array_action_activate_item (KatzeArrayAction* action,
|
||||
KatzeItem* item,
|
||||
gint button)
|
||||
{
|
||||
gboolean handled = FALSE;
|
||||
g_signal_emit (action, signals[ACTIVATE_ITEM_ALT], 0, item,
|
||||
button, &handled);
|
||||
if (!handled)
|
||||
g_signal_emit (action, signals[ACTIVATE_ITEM], 0, item);
|
||||
}
|
||||
|
||||
static void
|
||||
katze_array_action_menu_activate_cb (GtkWidget* proxy,
|
||||
KatzeArrayAction* array_action)
|
||||
{
|
||||
KatzeItem* item = g_object_get_data (G_OBJECT (proxy), "KatzeItem");
|
||||
g_signal_emit (array_action, signals[ACTIVATE_ITEM], 0, item);
|
||||
katze_array_action_activate_item (array_action, item, 1);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -271,13 +320,8 @@ katze_array_action_menu_button_press_cb (GtkWidget* proxy,
|
|||
KatzeArrayAction* array_action)
|
||||
{
|
||||
KatzeItem* item = g_object_get_data (G_OBJECT (proxy), "KatzeItem");
|
||||
gboolean handled;
|
||||
|
||||
g_signal_emit (array_action, signals[ACTIVATE_ITEM_ALT], 0, item,
|
||||
event->button, &handled);
|
||||
|
||||
if (!handled)
|
||||
g_signal_emit (array_action, signals[ACTIVATE_ITEM], 0, item);
|
||||
katze_array_action_activate_item (array_action, item, event->button);
|
||||
|
||||
/* we need to block the 'activate' handler which would be called
|
||||
* otherwise as well */
|
||||
|
@ -291,10 +335,29 @@ static void
|
|||
katze_array_action_menu_item_select_cb (GtkWidget* proxy,
|
||||
KatzeArrayAction* array_action);
|
||||
|
||||
static void
|
||||
/**
|
||||
* katze_array_action_generate_menu:
|
||||
* @array_action: a #KatzeArrayAction
|
||||
* @folder: the folder to represent
|
||||
* @menu: the menu shell to populate
|
||||
* @proxy: the proxy, or alternatively a widget in the same window
|
||||
*
|
||||
* Generates menu items according to @folder, in the way they
|
||||
* appear in automatically generated action proxies.
|
||||
* The primary use is for implementing "populate-folder".
|
||||
*
|
||||
* It is worth noting that @folder can be any folder and can
|
||||
* be generated dynamically if needed.
|
||||
*
|
||||
* The @proxy widget must be a related widget on the same screen,
|
||||
* but doesn't have to be a proxy of the action.
|
||||
*
|
||||
* Since: 0.2.8
|
||||
**/
|
||||
void
|
||||
katze_array_action_generate_menu (KatzeArrayAction* array_action,
|
||||
KatzeArray* array,
|
||||
GtkWidget* menu,
|
||||
GtkMenuShell* menu,
|
||||
GtkWidget* proxy)
|
||||
{
|
||||
gint i;
|
||||
|
@ -306,6 +369,9 @@ katze_array_action_generate_menu (KatzeArrayAction* array_action,
|
|||
GtkWidget* image;
|
||||
GtkWidget* submenu;
|
||||
|
||||
if (!KATZE_IS_ARRAY (array))
|
||||
return;
|
||||
|
||||
if (array_action->reversed)
|
||||
{
|
||||
i = katze_array_get_length (array);
|
||||
|
@ -319,11 +385,11 @@ katze_array_action_generate_menu (KatzeArrayAction* array_action,
|
|||
while ((item = katze_array_get_nth_item (array, i += summand)))
|
||||
{
|
||||
/* FIXME: The menu item should reflect changes to the item */
|
||||
if (!KATZE_IS_ARRAY (item) && !katze_item_get_uri (item))
|
||||
if (KATZE_ITEM_IS_SEPARATOR (item))
|
||||
{
|
||||
menuitem = gtk_separator_menu_item_new ();
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_menu_shell_append (menu, menuitem);
|
||||
continue;
|
||||
}
|
||||
menuitem = katze_image_menu_item_new_ellipsized (
|
||||
|
@ -332,7 +398,7 @@ katze_array_action_generate_menu (KatzeArrayAction* array_action,
|
|||
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
else
|
||||
{
|
||||
if (KATZE_IS_ARRAY (item))
|
||||
if (KATZE_ITEM_IS_FOLDER (item))
|
||||
icon = gtk_widget_render_icon (menuitem,
|
||||
GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL);
|
||||
else
|
||||
|
@ -345,9 +411,9 @@ katze_array_action_generate_menu (KatzeArrayAction* array_action,
|
|||
gtk_image_menu_item_set_always_show_image (
|
||||
GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
|
||||
#endif
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_menu_shell_append (menu, menuitem);
|
||||
g_object_set_data (G_OBJECT (menuitem), "KatzeItem", item);
|
||||
if (KATZE_IS_ARRAY (item))
|
||||
if (KATZE_ITEM_IS_FOLDER (item))
|
||||
{
|
||||
submenu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
|
||||
|
@ -372,13 +438,15 @@ katze_array_action_menu_item_select_cb (GtkWidget* proxy,
|
|||
{
|
||||
GtkWidget* menu;
|
||||
KatzeArray* array;
|
||||
gboolean handled;
|
||||
|
||||
menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (proxy));
|
||||
gtk_container_foreach (GTK_CONTAINER (menu),
|
||||
(GtkCallback)(gtk_widget_destroy), NULL);
|
||||
|
||||
array = g_object_get_data (G_OBJECT (proxy), "KatzeItem");
|
||||
katze_array_action_generate_menu (array_action, array, menu, proxy);
|
||||
katze_array_action_generate_menu (array_action, array, GTK_MENU_SHELL (menu), proxy);
|
||||
g_signal_emit (array_action, signals[POPULATE_FOLDER], 0, menu, array, &handled);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -387,11 +455,16 @@ katze_array_action_proxy_clicked_cb (GtkWidget* proxy,
|
|||
{
|
||||
GtkWidget* menu;
|
||||
KatzeArray* array;
|
||||
gboolean handled = FALSE;
|
||||
|
||||
if (GTK_IS_MENU_ITEM (proxy))
|
||||
{
|
||||
g_object_set_data (G_OBJECT (proxy), "KatzeItem", array_action->array);
|
||||
katze_array_action_menu_item_select_cb (proxy, array_action);
|
||||
g_signal_emit (array_action, signals[POPULATE_FOLDER], 0,
|
||||
gtk_menu_item_get_submenu (GTK_MENU_ITEM (proxy)),
|
||||
array_action->array, &handled);
|
||||
if (!handled)
|
||||
g_signal_emit (array_action, signals[POPULATE_POPUP], 0,
|
||||
gtk_menu_item_get_submenu (GTK_MENU_ITEM (proxy)));
|
||||
return;
|
||||
|
@ -400,7 +473,7 @@ katze_array_action_proxy_clicked_cb (GtkWidget* proxy,
|
|||
array = (KatzeArray*)g_object_get_data (G_OBJECT (proxy), "KatzeArray");
|
||||
if (KATZE_IS_ITEM (array) && katze_item_get_uri ((KatzeItem*)array))
|
||||
{
|
||||
g_signal_emit (array_action, signals[ACTIVATE_ITEM], 0, array);
|
||||
katze_array_action_activate_item (array_action, KATZE_ITEM (array), 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -408,11 +481,15 @@ katze_array_action_proxy_clicked_cb (GtkWidget* proxy,
|
|||
|
||||
if (!array)
|
||||
array = array_action->array;
|
||||
katze_array_action_generate_menu (array_action, array, menu, proxy);
|
||||
katze_array_action_generate_menu (array_action, array, GTK_MENU_SHELL (menu), proxy);
|
||||
|
||||
g_signal_emit (array_action, signals[POPULATE_FOLDER], 0, menu, array, &handled);
|
||||
if (!handled)
|
||||
{
|
||||
/* populate-popup should only affect the main proxy */
|
||||
if (array == array_action->array)
|
||||
g_signal_emit (array_action, signals[POPULATE_POPUP], 0, menu);
|
||||
}
|
||||
|
||||
#if HAVE_HILDON
|
||||
/* Avoid a bug in GTK+ messing up the initial scrolling position */
|
||||
|
@ -497,7 +574,7 @@ katze_array_action_item_notify_cb (KatzeItem* item,
|
|||
gtk_tool_item_set_tooltip_text (toolitem,
|
||||
katze_item_get_uri (item));
|
||||
}
|
||||
else if (!KATZE_IS_ARRAY (item) && !strcmp (property, "uri"))
|
||||
else if (KATZE_ITEM_IS_BOOKMARK (item) && !strcmp (property, "uri"))
|
||||
{
|
||||
icon = katze_load_cached_icon (katze_item_get_uri (item), GTK_WIDGET (toolitem));
|
||||
image = gtk_image_new_from_pixbuf (icon);
|
||||
|
@ -531,7 +608,7 @@ katze_array_action_proxy_create_menu_proxy_cb (GtkWidget* proxy,
|
|||
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
|
||||
else
|
||||
{
|
||||
if (KATZE_IS_ARRAY (item))
|
||||
if (KATZE_ITEM_IS_FOLDER (item))
|
||||
icon = gtk_widget_render_icon (menuitem,
|
||||
GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL);
|
||||
else
|
||||
|
@ -545,7 +622,7 @@ katze_array_action_proxy_create_menu_proxy_cb (GtkWidget* proxy,
|
|||
GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
|
||||
#endif
|
||||
g_object_set_data (G_OBJECT (menuitem), "KatzeItem", item);
|
||||
if (KATZE_IS_ARRAY (item))
|
||||
if (KATZE_ITEM_IS_FOLDER (item))
|
||||
{
|
||||
GtkWidget* submenu = gtk_menu_new ();
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
|
||||
|
@ -604,13 +681,13 @@ katze_array_action_create_tool_item_for (KatzeArrayAction* array_action,
|
|||
uri = katze_item_get_uri (item);
|
||||
desc = katze_item_get_text (item);
|
||||
|
||||
if (!KATZE_IS_ARRAY (item) && !uri)
|
||||
if (KATZE_ITEM_IS_SEPARATOR (item))
|
||||
return gtk_separator_tool_item_new ();
|
||||
|
||||
toolitem = gtk_tool_button_new (NULL, "");
|
||||
g_signal_connect (toolitem, "create-menu-proxy",
|
||||
G_CALLBACK (katze_array_action_proxy_create_menu_proxy_cb), item);
|
||||
if (KATZE_IS_ARRAY (item))
|
||||
if (KATZE_ITEM_IS_FOLDER (item))
|
||||
icon = gtk_widget_render_icon (GTK_WIDGET (toolitem),
|
||||
GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL);
|
||||
else
|
||||
|
|
|
@ -48,6 +48,12 @@ GtkToolItem*
|
|||
katze_array_action_create_tool_item_for (KatzeArrayAction* array_action,
|
||||
KatzeItem* item);
|
||||
|
||||
void
|
||||
katze_array_action_generate_menu (KatzeArrayAction* array_action,
|
||||
KatzeArray* folder,
|
||||
GtkMenuShell* menu,
|
||||
GtkWidget* proxy);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __KATZE_ARRAY_ACTION_H__ */
|
||||
|
|
|
@ -71,16 +71,7 @@ katze_net_finalize (GObject* object)
|
|||
G_OBJECT_CLASS (katze_net_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* katze_net_new:
|
||||
*
|
||||
* Instantiates a new #KatzeNet instance.
|
||||
*
|
||||
* Return value: a new #KatzeNet
|
||||
*
|
||||
* Deprecated: 0.2.7
|
||||
**/
|
||||
KatzeNet*
|
||||
static KatzeNet*
|
||||
katze_net_new (void)
|
||||
{
|
||||
static KatzeNet* net = NULL;
|
||||
|
@ -97,23 +88,6 @@ katze_net_new (void)
|
|||
return net;
|
||||
}
|
||||
|
||||
/**
|
||||
* katze_net_get_session:
|
||||
*
|
||||
* Retrieves the session of the net.
|
||||
*
|
||||
* Return value: a session, or %NULL
|
||||
*
|
||||
* Deprecated: 0.2.7: Use webkit_get_default_session ().
|
||||
**/
|
||||
gpointer
|
||||
katze_net_get_session (KatzeNet* net)
|
||||
{
|
||||
g_return_val_if_fail (KATZE_IS_NET (net), NULL);
|
||||
|
||||
return webkit_get_default_session ();
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
KatzeNet* net;
|
||||
|
@ -149,7 +123,6 @@ katze_net_get_cached_path (KatzeNet* net,
|
|||
gchar* cached_filename;
|
||||
gchar* cached_path;
|
||||
|
||||
if (!net)
|
||||
net = katze_net_new ();
|
||||
|
||||
if (subfolder)
|
||||
|
@ -207,26 +180,11 @@ katze_net_got_body_cb (SoupMessage* msg,
|
|||
KatzeNetPriv* priv)
|
||||
{
|
||||
KatzeNetRequest* request;
|
||||
#if 0
|
||||
gchar* filename;
|
||||
FILE* fp;
|
||||
#endif
|
||||
|
||||
request = priv->request;
|
||||
|
||||
if (msg->response_body->length > 0)
|
||||
{
|
||||
#if 0
|
||||
/* FIXME: Caching */
|
||||
filename = katze_net_get_cached_path (net, request->uri, NULL);
|
||||
if ((fp = fopen (filename, "wb")))
|
||||
{
|
||||
fwrite (msg->response_body->data,
|
||||
1, msg->response_body->length, fp);
|
||||
fclose (fp);
|
||||
}
|
||||
g_free (filename);
|
||||
#endif
|
||||
request->data = g_memdup (msg->response_body->data,
|
||||
msg->response_body->length);
|
||||
request->length = msg->response_body->length;
|
||||
|
@ -340,7 +298,6 @@ katze_net_load_uri (KatzeNet* net,
|
|||
if (!status_cb && !transfer_cb)
|
||||
return;
|
||||
|
||||
if (net == NULL)
|
||||
net = katze_net_new ();
|
||||
|
||||
request = g_new0 (KatzeNetRequest, 1);
|
||||
|
|
|
@ -37,12 +37,6 @@ typedef struct _KatzeNetClass KatzeNetClass;
|
|||
GType
|
||||
katze_net_get_type (void) G_GNUC_CONST;
|
||||
|
||||
KatzeNet*
|
||||
katze_net_new (void);
|
||||
|
||||
gpointer
|
||||
katze_net_get_session (KatzeNet* net);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
KATZE_NET_VERIFIED,
|
||||
|
|
|
@ -247,10 +247,14 @@ proxy_combo_box_changed_cb (GtkComboBox* button,
|
|||
}
|
||||
else if (value != custom_value && GTK_IS_ENTRY (child))
|
||||
{
|
||||
g_signal_handlers_block_by_func (
|
||||
button, proxy_combo_box_changed_cb, object);
|
||||
/* Force the combo to change the item again */
|
||||
gtk_widget_destroy (child);
|
||||
gtk_combo_box_set_active (button, value + 1);
|
||||
gtk_combo_box_set_active (button, value);
|
||||
g_signal_handlers_unblock_by_func (
|
||||
button, proxy_combo_box_changed_cb, object);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1132,9 +1136,8 @@ katze_bookmark_populate_tree_view (KatzeArray* array,
|
|||
KatzeItem* child;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeIter root_iter;
|
||||
guint i = 0;
|
||||
|
||||
while ((child = katze_array_get_nth_item (KATZE_ARRAY (array), i)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (child, array)
|
||||
{
|
||||
if (KATZE_ITEM_IS_BOOKMARK (child))
|
||||
{
|
||||
|
@ -1151,7 +1154,6 @@ katze_bookmark_populate_tree_view (KatzeArray* array,
|
|||
gtk_tree_store_insert_with_values (model, &iter, &root_iter,
|
||||
0, 0, NULL, -1);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1493,6 +1495,8 @@ katze_load_cached_icon (const gchar* uri,
|
|||
{
|
||||
GdkPixbuf* icon = NULL;
|
||||
|
||||
g_return_val_if_fail (uri != NULL, NULL);
|
||||
|
||||
if (g_str_has_prefix (uri, "http://") || g_str_has_prefix (uri,"https://"))
|
||||
{
|
||||
guint i;
|
||||
|
@ -1522,6 +1526,7 @@ katze_load_cached_icon (const gchar* uri,
|
|||
g_free (checksum);
|
||||
path = g_build_filename (g_get_user_cache_dir (), PACKAGE_NAME,
|
||||
"icons", filename, NULL);
|
||||
g_free (filename);
|
||||
if ((icon = gdk_pixbuf_new_from_file_at_size (path, 16, 16, NULL)))
|
||||
{
|
||||
g_free (path);
|
||||
|
@ -1534,95 +1539,3 @@ katze_load_cached_icon (const gchar* uri,
|
|||
GTK_STOCK_FILE, GTK_ICON_SIZE_MENU, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* katze_collfold:
|
||||
* @str: a non-NULL UTF-8 string
|
||||
*
|
||||
* Computes a string without case and decomposited so
|
||||
* it can be used for comparison.
|
||||
*
|
||||
* Return value: a normalized string
|
||||
*
|
||||
* Since: 0.2.3
|
||||
**/
|
||||
gchar*
|
||||
katze_collfold (const gchar* str)
|
||||
{
|
||||
GString* result = g_string_new (NULL);
|
||||
const gchar* p = str;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
gunichar ch = g_unichar_tolower (g_utf8_get_char (p));
|
||||
gsize len;
|
||||
gunichar* sch = g_unicode_canonical_decomposition (ch, &len);
|
||||
guint i = 0;
|
||||
while (i < len)
|
||||
g_string_append_unichar (result, sch[i++]);
|
||||
|
||||
p = g_utf8_next_char (p);
|
||||
}
|
||||
|
||||
return g_string_free (result, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* katze_utf8_stristr:
|
||||
* @haystack: a non-NULL UTF-8 string
|
||||
* @needle: a normalized non-NULL UTF-8 string
|
||||
*
|
||||
* Determines whether @needle is in @haystack, disregarding
|
||||
* differences in case.
|
||||
*
|
||||
* Return value: %TRUE if @needle is found in @haystack
|
||||
*
|
||||
* Since: 0.2.3
|
||||
**/
|
||||
gboolean
|
||||
katze_utf8_stristr (const gchar* haystack,
|
||||
const gchar* needle)
|
||||
{
|
||||
#if 0 /* 0,000159 seconds */
|
||||
/* Too slow for use in completion */
|
||||
gchar* nhaystack = g_utf8_normalize (haystack, -1, G_NORMALIZE_DEFAULT);
|
||||
const gchar *p = nhaystack;
|
||||
gsize len = strlen (needle);
|
||||
gsize i;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
for (i = 0; i < len; i++)
|
||||
if (g_unichar_tolower (g_utf8_get_char (p + i))
|
||||
!= g_unichar_tolower (g_utf8_get_char (needle + i)))
|
||||
goto next;
|
||||
|
||||
g_free (nhaystack);
|
||||
return TRUE;
|
||||
|
||||
next:
|
||||
p = g_utf8_next_char (p);
|
||||
}
|
||||
|
||||
g_free (nhaystack);
|
||||
return FALSE;
|
||||
#else /* 0,000044 seconds */
|
||||
/* No unicode matching */
|
||||
const gchar *p = haystack;
|
||||
gsize len = strlen (needle);
|
||||
gsize i;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
for (i = 0; i < len; i++)
|
||||
if (g_ascii_tolower (p[i]) != g_ascii_tolower (needle[i]))
|
||||
goto next;
|
||||
|
||||
return TRUE;
|
||||
|
||||
next:
|
||||
p++;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -34,13 +34,7 @@ G_BEGIN_DECLS
|
|||
*
|
||||
* Frees @lvalue if needed and assigns it the value of @rvalue.
|
||||
**/
|
||||
#define katze_assign(lvalue, rvalue) \
|
||||
do \
|
||||
{ \
|
||||
g_free (lvalue); \
|
||||
lvalue = rvalue; \
|
||||
} \
|
||||
while (0)
|
||||
#define katze_assign(lvalue, rvalue) lvalue = (g_free (lvalue), rvalue)
|
||||
|
||||
/**
|
||||
* katze_object_assign:
|
||||
|
@ -50,13 +44,7 @@ G_BEGIN_DECLS
|
|||
* Unrefs @lvalue if needed and assigns it the value of @rvalue.
|
||||
**/
|
||||
#define katze_object_assign(lvalue, rvalue) \
|
||||
do \
|
||||
{ \
|
||||
if (lvalue) \
|
||||
g_object_unref (lvalue); \
|
||||
lvalue = rvalue; \
|
||||
} \
|
||||
while (0)
|
||||
lvalue = ((lvalue ? g_object_unref (lvalue) : lvalue), rvalue)
|
||||
|
||||
/**
|
||||
* katze_strv_assign:
|
||||
|
@ -67,13 +55,7 @@ G_BEGIN_DECLS
|
|||
*
|
||||
* Since: 0.1.7
|
||||
**/
|
||||
#define katze_strv_assign(lvalue, rvalue) \
|
||||
do \
|
||||
{ \
|
||||
g_strfreev (lvalue); \
|
||||
lvalue = rvalue; \
|
||||
} \
|
||||
while (0)
|
||||
#define katze_strv_assign(lvalue, rvalue) lvalue = (g_strfreev (lvalue), rvalue)
|
||||
|
||||
GtkWidget*
|
||||
katze_property_proxy (gpointer object,
|
||||
|
@ -157,13 +139,6 @@ GdkPixbuf*
|
|||
katze_load_cached_icon (const gchar* uri,
|
||||
GtkWidget* widget);
|
||||
|
||||
gchar*
|
||||
katze_collfold (const gchar* str);
|
||||
|
||||
gboolean
|
||||
katze_utf8_stristr (const gchar* haystack,
|
||||
const gchar* needle);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __KATZE_UTILS_H__ */
|
||||
|
|
|
@ -244,8 +244,7 @@ settings_save_to_file (MidoriWebSettings* settings,
|
|||
|
||||
if (extensions)
|
||||
{
|
||||
i = 0;
|
||||
while ((extension = katze_array_get_nth_item (extensions, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (extension, extensions)
|
||||
if (midori_extension_is_active (extension))
|
||||
g_key_file_set_boolean (key_file, "extensions",
|
||||
g_object_get_data (G_OBJECT (extension), "filename"), TRUE);
|
||||
|
@ -315,7 +314,7 @@ search_engines_save_to_file (KatzeArray* search_engines,
|
|||
GError** error)
|
||||
{
|
||||
GKeyFile* key_file;
|
||||
guint i, j, n_properties;
|
||||
guint j, n_properties;
|
||||
KatzeItem* item;
|
||||
const gchar* name;
|
||||
GParamSpec** pspecs;
|
||||
|
@ -326,8 +325,7 @@ search_engines_save_to_file (KatzeArray* search_engines,
|
|||
key_file = g_key_file_new ();
|
||||
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (search_engines),
|
||||
&n_properties);
|
||||
i = 0;
|
||||
while ((item = katze_array_get_nth_item (search_engines, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, search_engines)
|
||||
{
|
||||
name = katze_item_get_name (item);
|
||||
for (j = 0; j < n_properties; j++)
|
||||
|
@ -508,12 +506,8 @@ static void
|
|||
midori_session_add_delay (KatzeArray* session)
|
||||
{
|
||||
KatzeItem* item;
|
||||
gint i = 0;
|
||||
while ((item = katze_array_get_nth_item (session, i++)))
|
||||
{
|
||||
if (katze_item_get_meta_integer (item, "delay") < 0)
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, session)
|
||||
katze_item_set_meta_integer (item, "delay", 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1126,7 +1120,7 @@ midori_load_extensions (gpointer data)
|
|||
GModule* module;
|
||||
typedef MidoriExtension* (*extension_init_func)(void);
|
||||
extension_init_func extension_init;
|
||||
MidoriExtension* extension;
|
||||
MidoriExtension* extension = NULL;
|
||||
|
||||
/* Ignore files which don't have the correct suffix */
|
||||
if (!g_str_has_suffix (filename, G_MODULE_SUFFIX))
|
||||
|
@ -1199,9 +1193,8 @@ midori_browser_action_last_session_activate_cb (GtkAction* action,
|
|||
GError* error = NULL;
|
||||
if (midori_array_from_file (old_session, config_file, "xbel", &error))
|
||||
{
|
||||
guint i = 0;
|
||||
KatzeItem* item;
|
||||
while ((item = katze_array_get_nth_item (old_session, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, old_session)
|
||||
midori_browser_add_item (browser, item);
|
||||
}
|
||||
else
|
||||
|
@ -1226,7 +1219,6 @@ midori_load_session (gpointer data)
|
|||
gchar* config_file;
|
||||
KatzeArray* session;
|
||||
KatzeItem* item;
|
||||
guint i;
|
||||
gint64 current;
|
||||
MidoriStartup load_on_startup;
|
||||
gchar** command = g_object_get_data (G_OBJECT (app), "execute-command");
|
||||
|
@ -1280,8 +1272,7 @@ midori_load_session (gpointer data)
|
|||
midori_session_add_delay (_session);
|
||||
|
||||
session = midori_browser_get_proxy_array (browser);
|
||||
i = 0;
|
||||
while ((item = katze_array_get_nth_item (_session, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, _session)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (item), "midori-view-append", (void*)1);
|
||||
midori_browser_add_item (browser, item);
|
||||
|
@ -1755,7 +1746,7 @@ main (int argc,
|
|||
"show-panel", FALSE,
|
||||
"toolbar-items", "Back,Forward,ReloadStop,Location",
|
||||
"homepage", NULL,
|
||||
"show-statusbar", TRUE,
|
||||
"show-statusbar", FALSE,
|
||||
"enable-developer-extras", FALSE,
|
||||
NULL);
|
||||
g_object_set (browser, "settings", settings, NULL);
|
||||
|
@ -2043,7 +2034,6 @@ main (int argc,
|
|||
uri_ready = midori_prepare_uri (uri);
|
||||
katze_item_set_uri (item, uri_ready);
|
||||
g_free (uri_ready);
|
||||
katze_item_set_meta_integer (item, "delay", 0);
|
||||
katze_array_add_item (_session, item);
|
||||
uri = strtok (NULL, "|");
|
||||
}
|
||||
|
@ -2060,8 +2050,7 @@ main (int argc,
|
|||
G_CALLBACK (midori_search_engines_modify_cb), search_engines);
|
||||
if (!katze_array_is_empty (search_engines))
|
||||
{
|
||||
i = 0;
|
||||
while ((item = katze_array_get_nth_item (search_engines, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, search_engines)
|
||||
g_signal_connect_after (item, "notify",
|
||||
G_CALLBACK (midori_search_engines_modify_cb), search_engines);
|
||||
}
|
||||
|
@ -2077,9 +2066,7 @@ main (int argc,
|
|||
and deleted during normal runtime, but persists in case of a crash. */
|
||||
katze_assign (config_file, build_config_filename ("running"));
|
||||
if (g_access (config_file, F_OK) == 0)
|
||||
{
|
||||
back_from_crash = TRUE;
|
||||
}
|
||||
else
|
||||
g_file_set_contents (config_file, "RUNNING", -1, NULL);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
BOOLEAN:OBJECT
|
||||
BOOLEAN:OBJECT,OBJECT
|
||||
BOOLEAN:OBJECT,UINT
|
||||
BOOLEAN:VOID
|
||||
OBJECT:OBJECT
|
||||
|
|
|
@ -96,8 +96,7 @@ enum
|
|||
PROP_HISTORY,
|
||||
PROP_EXTENSIONS,
|
||||
PROP_BROWSERS,
|
||||
PROP_BROWSER,
|
||||
PROP_BROWSER_COUNT
|
||||
PROP_BROWSER
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -394,22 +393,6 @@ midori_app_class_init (MidoriAppClass* class)
|
|||
"The current browser",
|
||||
MIDORI_TYPE_BROWSER,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* MidoriApp:browser-count:
|
||||
*
|
||||
* The number of browsers.
|
||||
*
|
||||
* Deprecated: 0.1.3 Use MidoriApp:browsers instead.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BROWSER_COUNT,
|
||||
g_param_spec_uint (
|
||||
"browser-count",
|
||||
"Browser Count",
|
||||
"The current number of browsers",
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -794,23 +777,18 @@ midori_app_set_property (GObject* object,
|
|||
break;
|
||||
case PROP_SETTINGS:
|
||||
katze_object_assign (app->settings, g_value_dup_object (value));
|
||||
/* FIXME: Propagate settings to all browsers */
|
||||
break;
|
||||
case PROP_BOOKMARKS:
|
||||
katze_object_assign (app->bookmarks, g_value_dup_object (value));
|
||||
/* FIXME: Propagate bookmarks to all browsers */
|
||||
break;
|
||||
case PROP_TRASH:
|
||||
katze_object_assign (app->trash, g_value_dup_object (value));
|
||||
/* FIXME: Propagate trash to all browsers */
|
||||
break;
|
||||
case PROP_SEARCH_ENGINES:
|
||||
katze_object_assign (app->search_engines, g_value_dup_object (value));
|
||||
/* FIXME: Propagate search engines to all browsers */
|
||||
break;
|
||||
case PROP_HISTORY:
|
||||
katze_object_assign (app->history, g_value_dup_object (value));
|
||||
/* FIXME: Propagate history to all browsers */
|
||||
break;
|
||||
case PROP_EXTENSIONS:
|
||||
katze_object_assign (app->extensions, g_value_dup_object (value));
|
||||
|
@ -858,9 +836,6 @@ midori_app_get_property (GObject* object,
|
|||
case PROP_BROWSER:
|
||||
g_value_set_object (value, app->browser);
|
||||
break;
|
||||
case PROP_BROWSER_COUNT:
|
||||
g_value_set_uint (value, katze_array_get_length (app->browsers));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
|
@ -589,7 +589,6 @@ string_append_item (GString* string,
|
|||
metadata = katze_item_metadata_to_xbel (item);
|
||||
if (KATZE_IS_ARRAY (item))
|
||||
{
|
||||
guint i = 0;
|
||||
KatzeItem* _item;
|
||||
KatzeArray* array = KATZE_ARRAY (item);
|
||||
|
||||
|
@ -597,7 +596,7 @@ string_append_item (GString* string,
|
|||
/* FIXME: " folded=\"no\" */
|
||||
string_append_xml_element (string, "title", katze_item_get_name (item));
|
||||
string_append_xml_element (string, "desc", katze_item_get_text (item));
|
||||
while ((_item = katze_array_get_nth_item (array, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (_item, array)
|
||||
string_append_item (string, _item);
|
||||
g_string_append (string, metadata);
|
||||
g_string_append (string, "</folder>\n");
|
||||
|
@ -679,7 +678,6 @@ katze_array_to_xbel (KatzeArray* array,
|
|||
GError** error)
|
||||
{
|
||||
gchar* metadata = katze_item_metadata_to_xbel (KATZE_ITEM (array));
|
||||
guint i;
|
||||
KatzeItem* item;
|
||||
|
||||
GString* markup = g_string_new (
|
||||
|
@ -693,8 +691,7 @@ katze_array_to_xbel (KatzeArray* array,
|
|||
string_append_xml_element (markup, "title", katze_item_get_name (KATZE_ITEM (array)));
|
||||
string_append_xml_element (markup, "desc", katze_item_get_text (KATZE_ITEM (array)));
|
||||
g_string_append (markup, metadata);
|
||||
i = 0;
|
||||
while ((item = katze_array_get_nth_item (array, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, array)
|
||||
string_append_item (markup, item);
|
||||
g_string_append (markup, "</xbel>\n");
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ _midori_browser_set_statusbar_text (MidoriBrowser* browser,
|
|||
|
||||
katze_assign (browser->statusbar_text, sokoke_format_uri_for_display (text));
|
||||
|
||||
if (!gtk_widget_get_visible (browser->statusbar) && !is_location)
|
||||
if (!browser->show_statusbar && !is_location)
|
||||
{
|
||||
GtkAction* action = _action_by_name (browser, "Location");
|
||||
MidoriLocationAction* location_action = MIDORI_LOCATION_ACTION (action);
|
||||
|
@ -992,6 +992,11 @@ midori_browser_prepare_download (MidoriBrowser* browser,
|
|||
}
|
||||
|
||||
webkit_download_set_destination_uri (download, uri);
|
||||
if (!browser->show_statusbar && gtk_widget_get_visible (browser->transferbar))
|
||||
{
|
||||
_midori_browser_set_statusbar_text (browser, NULL);
|
||||
gtk_widget_show (browser->statusbar);
|
||||
}
|
||||
midori_transferbar_add_download_item (MIDORI_TRANSFERBAR (browser->transferbar), download);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2126,7 +2131,6 @@ _action_private_browsing_activate (GtkAction* action,
|
|||
const gchar* uri = midori_browser_get_current_uri (browser);
|
||||
if (uri != NULL)
|
||||
{
|
||||
/* FIXME: Use the same binary that is running right now */
|
||||
if (*uri != '\0')
|
||||
midori_browser_spawn_app (uri);
|
||||
else
|
||||
|
@ -2557,7 +2561,7 @@ midori_browser_get_toolbar_actions (MidoriBrowser* browser)
|
|||
{
|
||||
static const gchar* actions[] = {
|
||||
"WindowNew", "TabNew", "Open", "SaveAs", "Print", "Find",
|
||||
"Fullscreen", "Preferences", "Window",
|
||||
"Fullscreen", "Preferences", "Window", "Bookmarks",
|
||||
"ReloadStop", "ZoomIn", "TabClose",
|
||||
"ZoomOut", "Separator", "Back", "Forward", "Homepage",
|
||||
"Panel", "Trash", "Search", "BookmarkAdd", "Previous", "Next", NULL };
|
||||
|
@ -2648,28 +2652,23 @@ midori_browser_menu_item_deselect_cb (GtkWidget* menuitem,
|
|||
_midori_browser_set_statusbar_text (browser, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
midori_bookmarkbar_activate_item (GtkAction* action,
|
||||
KatzeItem* item,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
midori_browser_open_bookmark (browser, item);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
midori_bookmarkbar_activate_item_alt (GtkAction* action,
|
||||
KatzeItem* item,
|
||||
guint button,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
if (button == 2)
|
||||
if (button == 1)
|
||||
{
|
||||
midori_browser_open_bookmark (browser, item);
|
||||
}
|
||||
else if (button == 2)
|
||||
{
|
||||
gint n = midori_browser_add_uri (browser, katze_item_get_uri (item));
|
||||
midori_browser_set_current_page_smartly (browser, n);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2699,33 +2698,28 @@ _action_trash_populate_popup (GtkAction* action,
|
|||
gtk_widget_show (menuitem);
|
||||
}
|
||||
|
||||
static void
|
||||
_action_trash_activate_item (GtkAction* action,
|
||||
KatzeItem* item,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
guint n = midori_browser_add_item (browser, item);
|
||||
midori_browser_set_current_page (browser, n);
|
||||
katze_array_remove_item (browser->trash, item);
|
||||
_midori_browser_update_actions (browser);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_action_trash_activate_item_alt (GtkAction* action,
|
||||
KatzeItem* item,
|
||||
guint button,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
if (button == 2)
|
||||
if (button == 1)
|
||||
{
|
||||
gint n = midori_browser_add_uri (browser, katze_item_get_uri (item));
|
||||
guint n = midori_browser_add_item (browser, item);
|
||||
midori_browser_set_current_page (browser, n);
|
||||
katze_array_remove_item (browser->trash, item);
|
||||
_midori_browser_update_actions (browser);
|
||||
}
|
||||
else if (button == 2)
|
||||
{
|
||||
gint n = midori_browser_add_item (browser, item);
|
||||
midori_browser_set_current_page_smartly (browser, n);
|
||||
katze_array_remove_item (browser->trash, item);
|
||||
_midori_browser_update_actions (browser);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
|
@ -2743,7 +2737,6 @@ midori_browser_open_bookmark (MidoriBrowser* browser,
|
|||
if (!uri_fixed)
|
||||
uri_fixed = g_strdup (uri);
|
||||
|
||||
/* FIXME: Use the same binary that is running right now */
|
||||
if (katze_item_get_meta_boolean (item, "app"))
|
||||
midori_browser_spawn_app (uri_fixed);
|
||||
else
|
||||
|
@ -2817,6 +2810,45 @@ midori_browser_bookmark_popup (GtkWidget* widget,
|
|||
KatzeItem* item,
|
||||
MidoriBrowser* browser);
|
||||
|
||||
static gboolean
|
||||
_action_bookmarks_populate_folder (GtkAction* action,
|
||||
GtkMenuShell* menu,
|
||||
KatzeArray* folder,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
const char* sqlcmd = "SELECT uri, title, app, folder "
|
||||
"FROM bookmarks WHERE folder = '%q' ORDER BY uri ASC";
|
||||
sqlite3* db = g_object_get_data (G_OBJECT (browser->bookmarks), "db");
|
||||
const gchar* folder_name;
|
||||
char* sqlcmd_folder;
|
||||
KatzeArray* bookmarks;
|
||||
GtkWidget* menuitem;
|
||||
|
||||
if (!db)
|
||||
return FALSE;
|
||||
|
||||
/* Clear items from dummy array here */
|
||||
gtk_container_foreach (GTK_CONTAINER (menu),
|
||||
(GtkCallback)(gtk_widget_destroy), NULL);
|
||||
|
||||
folder_name = katze_item_get_name (KATZE_ITEM (folder));
|
||||
sqlcmd_folder = sqlite3_mprintf (sqlcmd, folder_name ? folder_name : "");
|
||||
bookmarks = katze_array_from_sqlite (db, sqlcmd_folder);
|
||||
sqlite3_free (sqlcmd_folder);
|
||||
if (!bookmarks || katze_array_is_empty (bookmarks))
|
||||
{
|
||||
menuitem = gtk_image_menu_item_new_with_label (_("Empty"));
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
gtk_menu_shell_append (menu, menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
katze_array_action_generate_menu (KATZE_ARRAY_ACTION (action), bookmarks,
|
||||
menu, GTK_WIDGET (browser));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_action_window_populate_popup (GtkAction* action,
|
||||
GtkMenu* menu,
|
||||
|
@ -2857,16 +2889,17 @@ _action_window_populate_popup (GtkAction* action,
|
|||
}
|
||||
|
||||
static void
|
||||
_action_window_activate_item (GtkAction* action,
|
||||
_action_window_activate_item_alt (GtkAction* action,
|
||||
KatzeItem* item,
|
||||
gint button,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
guint i, n;
|
||||
GtkWidget* view;
|
||||
guint i;
|
||||
guint n = katze_array_get_length (browser->proxy_array);
|
||||
|
||||
n = katze_array_get_length (browser->proxy_array);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
GtkWidget* view;
|
||||
view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), i);
|
||||
if (midori_view_get_proxy_item (MIDORI_VIEW (view)) == item)
|
||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), i);
|
||||
|
@ -3220,7 +3253,6 @@ midori_browser_source_transfer_cb (KatzeNetRequest* request,
|
|||
fclose (fp);
|
||||
if ((ret - request->length) != 0)
|
||||
{
|
||||
/* FIXME: Show an error in the graphical interface */
|
||||
g_warning ("Error writing to file %s "
|
||||
"in midori_browser_source_transfer_cb()", filename);
|
||||
}
|
||||
|
@ -3274,7 +3306,6 @@ _action_source_view_activate (GtkAction* action,
|
|||
#else
|
||||
GError* error = NULL;
|
||||
|
||||
/* FIXME: Handling http transparently in the function would be nice */
|
||||
if (g_str_has_prefix (uri, "file://"))
|
||||
{
|
||||
if (!sokoke_show_uri_with_mime_type (gtk_widget_get_screen (view),
|
||||
|
@ -3426,26 +3457,6 @@ _action_location_active_changed (GtkAction* action,
|
|||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
midori_browser_bookmark_homepage_button_press_cb (GtkToolItem* button,
|
||||
GdkEventButton* event,
|
||||
MidoriBrowser* browser)
|
||||
{
|
||||
if (event->button == 2)
|
||||
{
|
||||
gchar* homepage;
|
||||
guint n;
|
||||
|
||||
g_object_get (browser->settings, "homepage", &homepage, NULL);
|
||||
n = midori_browser_add_uri (browser, homepage);
|
||||
g_free (homepage);
|
||||
midori_browser_set_current_page_smartly (browser, n);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_action_location_focus_in (GtkAction* action,
|
||||
MidoriBrowser* browser)
|
||||
|
@ -3784,16 +3795,14 @@ midori_browser_bookmark_open_in_tab_activate_cb (GtkWidget* menuitem,
|
|||
if (KATZE_IS_ARRAY (item))
|
||||
{
|
||||
KatzeItem* child;
|
||||
guint i = 0;
|
||||
|
||||
while ((child = katze_array_get_nth_item (KATZE_ARRAY (item), i)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (child, KATZE_ARRAY (item))
|
||||
{
|
||||
if ((uri = katze_item_get_uri (child)) && *uri)
|
||||
{
|
||||
n = midori_browser_add_item (browser, child);
|
||||
midori_browser_set_current_page_smartly (browser, n);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4036,8 +4045,7 @@ _action_bookmarks_import_activate (GtkAction* action,
|
|||
db = g_object_get_data (G_OBJECT (browser->bookmarks), "db");
|
||||
sqlcmd = "SELECT title from bookmarks where uri=''";
|
||||
bookmarkdirs = katze_array_from_sqlite (db, sqlcmd);
|
||||
i = 0;
|
||||
while ((item = katze_array_get_nth_item (bookmarkdirs, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, bookmarkdirs)
|
||||
{
|
||||
const gchar* name = katze_item_get_name (item);
|
||||
gtk_combo_box_append_text (combobox_folder, name);
|
||||
|
@ -4423,11 +4431,9 @@ _action_tab_duplicate_activate (GtkAction* action,
|
|||
{
|
||||
GtkWidget* view = midori_browser_get_current_tab (browser);
|
||||
MidoriNewView where = MIDORI_NEW_VIEW_TAB;
|
||||
GtkWidget* new_view = g_object_new (MIDORI_TYPE_VIEW,
|
||||
"settings", browser->settings, NULL);
|
||||
midori_view_set_uri (MIDORI_VIEW (new_view),
|
||||
midori_view_get_display_uri (MIDORI_VIEW (view)));
|
||||
gtk_widget_show (new_view);
|
||||
GtkWidget* new_view = midori_view_new_with_uri (
|
||||
midori_view_get_display_uri (MIDORI_VIEW (view)),
|
||||
NULL, browser->settings);
|
||||
g_signal_emit_by_name (view, "new-view", new_view, where);
|
||||
}
|
||||
|
||||
|
@ -4769,13 +4775,7 @@ midori_browser_notebook_button_press_event_after_cb (GtkNotebook* notebook,
|
|||
|| */(event->type == GDK_BUTTON_PRESS && event->button == 2))
|
||||
{
|
||||
gint n;
|
||||
GtkWidget* view;
|
||||
|
||||
view = g_object_new (MIDORI_TYPE_VIEW,
|
||||
"settings", browser->settings,
|
||||
NULL);
|
||||
midori_view_set_uri (MIDORI_VIEW (view), "");
|
||||
gtk_widget_show (view);
|
||||
GtkWidget* view = midori_view_new_with_uri ("", NULL, browser->settings);
|
||||
g_object_set_data (G_OBJECT (view), "midori-view-append", (void*)1);
|
||||
n = midori_browser_add_tab (browser, view);
|
||||
midori_browser_set_current_page (browser, n);
|
||||
|
@ -4952,11 +4952,11 @@ static const GtkActionEntry entries[] =
|
|||
NULL, "<Alt>Right",
|
||||
N_("Go forward to the next page"), G_CALLBACK (_action_navigation_activate) },
|
||||
{ "Previous", GTK_STOCK_MEDIA_PREVIOUS,
|
||||
NULL, "<Ctrl>Left",
|
||||
NULL, "<Alt><Shift>Left",
|
||||
/* i18n: Visit the previous logical page, ie. in a forum or blog */
|
||||
N_("Go to the previous sub-page"), G_CALLBACK (_action_navigation_activate) },
|
||||
{ "Next", GTK_STOCK_MEDIA_NEXT,
|
||||
NULL, "<Ctrl>Right",
|
||||
NULL, "<Alt><Shift>Right",
|
||||
/* i18n: Visit the following logical page, ie. in a forum or blog */
|
||||
N_("Go to the next sub-page"), G_CALLBACK (_action_navigation_activate) },
|
||||
{ "Homepage", STOCK_HOMEPAGE,
|
||||
|
@ -5268,6 +5268,7 @@ static const gchar* ui_markup =
|
|||
"<menuitem action='Search'/>"
|
||||
"<menuitem action='Trash'/>"
|
||||
"</menu>"
|
||||
"<menuitem action='Bookmarks'/>"
|
||||
"<menuitem action='Tools'/>"
|
||||
"<menuitem action='Window'/>"
|
||||
"<menu action='Help'>"
|
||||
|
@ -5595,7 +5596,6 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
error = NULL;
|
||||
if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_markup, -1, &error))
|
||||
{
|
||||
/* TODO: Should this be a message dialog? When does this happen? */
|
||||
g_message ("User interface couldn't be created: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
@ -5666,14 +5666,28 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
g_object_connect (action,
|
||||
"signal::populate-popup",
|
||||
_action_trash_populate_popup, browser,
|
||||
"signal::activate-item",
|
||||
_action_trash_activate_item, browser,
|
||||
"signal::activate-item-alt",
|
||||
_action_trash_activate_item_alt, browser,
|
||||
NULL);
|
||||
gtk_action_group_add_action_with_accel (browser->action_group, action, "");
|
||||
g_object_unref (action);
|
||||
|
||||
action = g_object_new (KATZE_TYPE_ARRAY_ACTION,
|
||||
"name", "Bookmarks",
|
||||
"label", _("_Bookmarks"),
|
||||
"stock-id", STOCK_BOOKMARKS,
|
||||
"tooltip", _("Show the saved bookmarks"),
|
||||
"array", browser->proxy_array, /* Use a non-empty array here */
|
||||
NULL);
|
||||
g_object_connect (action,
|
||||
"signal::populate-folder",
|
||||
_action_bookmarks_populate_folder, browser,
|
||||
"signal::activate-item-alt",
|
||||
midori_bookmarkbar_activate_item_alt, browser,
|
||||
NULL);
|
||||
gtk_action_group_add_action_with_accel (browser->action_group, action, "");
|
||||
g_object_unref (action);
|
||||
|
||||
action = g_object_new (KATZE_TYPE_ARRAY_ACTION,
|
||||
"name", "Tools",
|
||||
"label", _("_Tools"),
|
||||
|
@ -5683,8 +5697,6 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
g_object_connect (action,
|
||||
"signal::populate-popup",
|
||||
_action_tools_populate_popup, browser,
|
||||
"signal::activate-item",
|
||||
midori_bookmarkbar_activate_item, browser,
|
||||
"signal::activate-item-alt",
|
||||
midori_bookmarkbar_activate_item_alt, browser,
|
||||
NULL);
|
||||
|
@ -5701,8 +5713,8 @@ midori_browser_init (MidoriBrowser* browser)
|
|||
g_object_connect (action,
|
||||
"signal::populate-popup",
|
||||
_action_window_populate_popup, browser,
|
||||
"signal::activate-item",
|
||||
_action_window_activate_item, browser,
|
||||
"signal::activate-item-alt",
|
||||
_action_window_activate_item_alt, browser,
|
||||
NULL);
|
||||
gtk_action_group_add_action_with_accel (browser->action_group, action, "");
|
||||
g_object_unref (action);
|
||||
|
@ -6089,7 +6101,6 @@ _midori_browser_update_settings (MidoriBrowser* browser)
|
|||
gint last_panel_position, last_panel_page;
|
||||
gboolean show_menubar, show_bookmarkbar;
|
||||
gboolean show_panel, show_transferbar;
|
||||
gchar* homepage;
|
||||
MidoriToolbarStyle toolbar_style;
|
||||
gchar* toolbar_items;
|
||||
gint last_web_search;
|
||||
|
@ -6115,7 +6126,6 @@ _midori_browser_update_settings (MidoriBrowser* browser)
|
|||
"show-panel", &show_panel,
|
||||
"show-transferbar", &show_transferbar,
|
||||
"show-statusbar", &browser->show_statusbar,
|
||||
"homepage", &homepage,
|
||||
"speed-dial-in-new-tabs", &browser->speed_dial_in_new_tabs,
|
||||
"toolbar-style", &toolbar_style,
|
||||
"toolbar-items", &toolbar_items,
|
||||
|
@ -6167,16 +6177,13 @@ _midori_browser_update_settings (MidoriBrowser* browser)
|
|||
|
||||
if (browser->search_engines)
|
||||
{
|
||||
guint i;
|
||||
|
||||
item = katze_array_get_nth_item (browser->search_engines,
|
||||
last_web_search);
|
||||
if (item)
|
||||
midori_search_action_set_current_item (MIDORI_SEARCH_ACTION (
|
||||
_action_by_name (browser, "Search")), item);
|
||||
|
||||
i = 0;
|
||||
while ((item = katze_array_get_nth_item (browser->search_engines, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, browser->search_engines)
|
||||
if (!g_strcmp0 (katze_item_get_uri (item), browser->location_entry_search))
|
||||
{
|
||||
midori_search_action_set_default_item (MIDORI_SEARCH_ACTION (
|
||||
|
@ -6207,9 +6214,7 @@ _midori_browser_update_settings (MidoriBrowser* browser)
|
|||
_action_set_active (browser, "Transferbar", show_transferbar);
|
||||
#endif
|
||||
_action_set_active (browser, "Statusbar", browser->show_statusbar);
|
||||
_action_set_visible (browser, "Homepage", homepage && *homepage);
|
||||
|
||||
g_free (homepage);
|
||||
g_free (toolbar_items);
|
||||
}
|
||||
|
||||
|
@ -6262,11 +6267,6 @@ midori_browser_settings_notify (MidoriWebSettings* web_settings,
|
|||
browser->speed_dial_in_new_tabs = g_value_get_boolean (&value);
|
||||
else if (name == g_intern_string ("progress-in-location"))
|
||||
browser->progress_in_location = g_value_get_boolean (&value);
|
||||
else if (name == g_intern_string ("homepage"))
|
||||
{
|
||||
_action_set_visible (browser, "Homepage",
|
||||
g_value_get_string (&value) && *g_value_get_string (&value));
|
||||
}
|
||||
else if (name == g_intern_string ("search-engines-in-completion"))
|
||||
{
|
||||
if (g_value_get_boolean (&value))
|
||||
|
@ -6355,21 +6355,16 @@ midori_bookmarkbar_remove_item_cb (KatzeArray* bookmarks,
|
|||
static void
|
||||
midori_bookmarkbar_populate (MidoriBrowser* browser)
|
||||
{
|
||||
GtkWidget* homepage;
|
||||
sqlite3* db;
|
||||
const gchar* sqlcmd;
|
||||
KatzeArray* array;
|
||||
KatzeItem* item;
|
||||
gint i = 0;
|
||||
|
||||
midori_bookmarkbar_clear (browser->bookmarkbar);
|
||||
|
||||
homepage = gtk_action_create_tool_item (_action_by_name (browser, "Homepage"));
|
||||
gtk_tool_item_set_is_important (GTK_TOOL_ITEM (homepage), TRUE);
|
||||
g_signal_connect (gtk_bin_get_child (GTK_BIN (homepage)), "button-press-event",
|
||||
G_CALLBACK (midori_browser_bookmark_homepage_button_press_cb), browser);
|
||||
/* Use a dummy to ensure height of the toolbar */
|
||||
gtk_toolbar_insert (GTK_TOOLBAR (browser->bookmarkbar),
|
||||
(GtkToolItem*)homepage, -1);
|
||||
gtk_separator_tool_item_new (), -1);
|
||||
|
||||
db = g_object_get_data (G_OBJECT (browser->bookmarks), "db");
|
||||
if (!db)
|
||||
|
@ -6386,7 +6381,7 @@ midori_bookmarkbar_populate (MidoriBrowser* browser)
|
|||
return;
|
||||
}
|
||||
|
||||
while ((item = katze_array_get_nth_item (KATZE_ARRAY (array), i)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, array)
|
||||
{
|
||||
if (KATZE_ITEM_IS_BOOKMARK (item))
|
||||
midori_bookmarkbar_insert_item (browser->bookmarkbar, item);
|
||||
|
@ -6402,7 +6397,6 @@ midori_bookmarkbar_populate (MidoriBrowser* browser)
|
|||
midori_bookmarkbar_insert_item (browser->bookmarkbar, KATZE_ITEM (subfolder));
|
||||
g_free (subsqlcmd);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
_action_set_sensitive (browser, "BookmarkAdd", TRUE);
|
||||
_action_set_sensitive (browser, "BookmarkFolderAdd", TRUE);
|
||||
|
@ -6509,8 +6503,6 @@ midori_browser_set_property (GObject* object,
|
|||
break;
|
||||
case PROP_SEARCH_ENGINES:
|
||||
{
|
||||
guint i;
|
||||
|
||||
/* FIXME: Disconnect handlers */
|
||||
katze_object_assign (browser->search_engines, g_value_dup_object (value));
|
||||
if (katze_object_get_boolean (browser->settings,
|
||||
|
@ -6531,8 +6523,7 @@ midori_browser_set_property (GObject* object,
|
|||
midori_search_action_set_current_item (MIDORI_SEARCH_ACTION (
|
||||
_action_by_name (browser, "Search")), item);
|
||||
|
||||
i = 0;
|
||||
while ((item = katze_array_get_nth_item (browser->search_engines, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, browser->search_engines)
|
||||
if (!g_strcmp0 (katze_item_get_uri (item), browser->location_entry_search))
|
||||
{
|
||||
midori_search_action_set_default_item (MIDORI_SEARCH_ACTION (
|
||||
|
@ -6712,23 +6703,16 @@ midori_browser_add_item (MidoriBrowser* browser,
|
|||
|
||||
uri = katze_item_get_uri (item);
|
||||
title = katze_item_get_name (item);
|
||||
view = g_object_new (MIDORI_TYPE_VIEW,
|
||||
"title", title,
|
||||
"settings", browser->settings,
|
||||
NULL);
|
||||
/* Blank pages should not be delayed */
|
||||
if (katze_item_get_meta_integer (item, "delay") > 0
|
||||
&& uri != NULL && strcmp (uri, "about:blank") != 0)
|
||||
{
|
||||
gchar* new_uri;
|
||||
new_uri = g_strdup_printf ("pause:%s", uri);
|
||||
midori_view_set_uri (MIDORI_VIEW (view), new_uri);
|
||||
gchar* new_uri = g_strdup_printf ("pause:%s", uri);
|
||||
view = midori_view_new_with_uri (new_uri, title, browser->settings);
|
||||
g_free (new_uri);
|
||||
}
|
||||
else
|
||||
midori_view_set_uri (MIDORI_VIEW (view), uri);
|
||||
|
||||
gtk_widget_show (view);
|
||||
view = midori_view_new_with_uri (uri, title, browser->settings);
|
||||
|
||||
/* FIXME: We should have public API for that */
|
||||
if (g_object_get_data (G_OBJECT (item), "midori-view-append"))
|
||||
|
@ -6766,11 +6750,7 @@ midori_browser_add_uri (MidoriBrowser* browser,
|
|||
g_return_val_if_fail (MIDORI_IS_BROWSER (browser), -1);
|
||||
g_return_val_if_fail (uri != NULL, -1);
|
||||
|
||||
view = g_object_new (MIDORI_TYPE_VIEW, "settings", browser->settings,
|
||||
NULL);
|
||||
midori_view_set_uri (MIDORI_VIEW (view), uri);
|
||||
gtk_widget_show (view);
|
||||
|
||||
view = midori_view_new_with_uri (uri, NULL, browser->settings);
|
||||
return midori_browser_add_tab (browser, view);
|
||||
}
|
||||
|
||||
|
|
|
@ -457,7 +457,6 @@ midori_location_action_popup_timeout_cb (gpointer data)
|
|||
style = gtk_widget_get_style (action->treeview);
|
||||
while (result == SQLITE_ROW)
|
||||
{
|
||||
gchar* unescaped_uri;
|
||||
sqlite3_int64 type = sqlite3_column_int64 (stmt, 0);
|
||||
const unsigned char* uri = sqlite3_column_text (stmt, 1);
|
||||
const unsigned char* title = sqlite3_column_text (stmt, 2);
|
||||
|
@ -466,12 +465,9 @@ midori_location_action_popup_timeout_cb (gpointer data)
|
|||
icon = action->default_icon;
|
||||
if (type == 1 /* history_view */)
|
||||
{
|
||||
unescaped_uri = sokoke_uri_unescape_string ((const char*)uri);
|
||||
|
||||
gtk_list_store_insert_with_values (store, NULL, matches,
|
||||
URI_COL, unescaped_uri, TITLE_COL, title, YALIGN_COL, 0.25,
|
||||
URI_COL, uri, TITLE_COL, title, YALIGN_COL, 0.25,
|
||||
FAVICON_COL, icon, -1);
|
||||
g_free (unescaped_uri);
|
||||
}
|
||||
else if (type == 2 /* search_view */)
|
||||
{
|
||||
|
@ -490,9 +486,9 @@ midori_location_action_popup_timeout_cb (gpointer data)
|
|||
|
||||
if (action->search_engines)
|
||||
{
|
||||
gint i = 0;
|
||||
KatzeItem* item;
|
||||
while ((item = katze_array_get_nth_item (action->search_engines, i)))
|
||||
i = 0;
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, action->search_engines)
|
||||
{
|
||||
gchar* uri;
|
||||
gchar* title;
|
||||
|
@ -549,7 +545,6 @@ midori_location_action_popup_completion (MidoriLocationAction* action,
|
|||
G_CALLBACK (gtk_widget_destroyed), &action->entry);
|
||||
action->completion_timeout = g_timeout_add (COMPLETION_DELAY,
|
||||
midori_location_action_popup_timeout_cb, action);
|
||||
/* TODO: Inline completion */
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -897,6 +892,48 @@ midori_location_action_key_press_event_cb (GtkEntry* entry,
|
|||
case GDK_Page_Down:
|
||||
if (!(location_action->popup && gtk_widget_get_visible (location_action->popup)))
|
||||
return TRUE;
|
||||
case GDK_Delete:
|
||||
case GDK_KP_Delete:
|
||||
{
|
||||
gint selected = location_action->completion_index;
|
||||
GtkTreeModel* model = location_action->completion_model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (selected > -1 &&
|
||||
gtk_tree_model_iter_nth_child (model, &iter, NULL, selected))
|
||||
{
|
||||
gchar* uri;
|
||||
gchar* sqlcmd;
|
||||
sqlite3* db;
|
||||
gchar* errmsg;
|
||||
gint result;
|
||||
|
||||
gtk_tree_model_get (model, &iter, URI_COL, &uri, -1);
|
||||
sqlcmd = sqlite3_mprintf ("DELETE FROM history "
|
||||
"WHERE uri = '%q'", uri);
|
||||
g_free (uri);
|
||||
db = g_object_get_data (G_OBJECT (location_action->history), "db");
|
||||
result = sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg);
|
||||
sqlite3_free (sqlcmd);
|
||||
if (result == SQLITE_ERROR)
|
||||
{
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
URI_COL, errmsg, -1);
|
||||
sqlite3_free (errmsg);
|
||||
break;
|
||||
}
|
||||
if (result != SQLITE_OK || sqlite3_changes (db) == 0)
|
||||
break;
|
||||
if (!gtk_list_store_remove (GTK_LIST_STORE (model), &iter))
|
||||
{
|
||||
midori_location_action_popdown_completion (location_action);
|
||||
break;
|
||||
}
|
||||
/* Fall through to advance the selection */
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
case GDK_Down:
|
||||
case GDK_KP_Down:
|
||||
case GDK_Up:
|
||||
|
@ -1024,9 +1061,9 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
|
|||
gpointer data)
|
||||
{
|
||||
MidoriLocationAction* action = data;
|
||||
gchar* uri_escaped;
|
||||
gchar* uri;
|
||||
gchar* title;
|
||||
GdkColor* background;
|
||||
gboolean style;
|
||||
gchar* desc;
|
||||
gchar* desc_uri;
|
||||
|
@ -1043,17 +1080,16 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
|
|||
gchar* temp_concat;
|
||||
gchar* temp_markup;
|
||||
gchar** parts;
|
||||
size_t len;
|
||||
size_t offset;
|
||||
|
||||
gtk_tree_model_get (model, iter, URI_COL, &uri, TITLE_COL, &title,
|
||||
BACKGROUND_COL, &background, STYLE_COL, &style, -1);
|
||||
gtk_tree_model_get (model, iter, URI_COL, &uri_escaped, TITLE_COL, &title,
|
||||
STYLE_COL, &style, -1);
|
||||
|
||||
if (style) /* A search engine action */
|
||||
{
|
||||
g_object_set (renderer, "text", title,
|
||||
"ellipsize-set", TRUE, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
|
||||
g_free (uri);
|
||||
g_free (uri_escaped);
|
||||
g_free (title);
|
||||
return;
|
||||
}
|
||||
|
@ -1068,16 +1104,19 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
|
|||
keys = g_strsplit_set (key, " %", -1);
|
||||
g_free (key);
|
||||
|
||||
uri = sokoke_uri_unescape_string (uri_escaped);
|
||||
g_free (uri_escaped);
|
||||
|
||||
if (G_LIKELY (uri))
|
||||
{
|
||||
temp_iter = temp = g_utf8_strdown (uri, -1);
|
||||
desc_iter = uri;
|
||||
key_idx = 0;
|
||||
key = keys[key_idx];
|
||||
len = strlen (key);
|
||||
offset = 0;
|
||||
while ((start = strstr (temp_iter, key)) && start)
|
||||
while (key && (start = strstr (temp_iter, key)) && start)
|
||||
{
|
||||
gsize len = strlen (key);
|
||||
if (len)
|
||||
{
|
||||
offset = (start - temp_iter);
|
||||
|
@ -1110,7 +1149,6 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
|
|||
key = keys[key_idx];
|
||||
if (key == NULL)
|
||||
break;
|
||||
len = strlen (key);
|
||||
}
|
||||
if (key)
|
||||
katze_assign (desc_uri, NULL);
|
||||
|
@ -1132,10 +1170,10 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
|
|||
desc_iter = title;
|
||||
key_idx = 0;
|
||||
key = keys[key_idx];
|
||||
len = strlen (key);
|
||||
offset = 0;
|
||||
while ((start = strstr (temp_iter, key)) && start)
|
||||
while (key && (start = strstr (temp_iter, key)) && start)
|
||||
{
|
||||
gsize len = strlen (key);
|
||||
if (len)
|
||||
{
|
||||
offset = (start - temp_iter);
|
||||
|
@ -1168,7 +1206,6 @@ midori_location_entry_render_text_cb (GtkCellLayout* layout,
|
|||
key = keys[key_idx];
|
||||
if (key == NULL)
|
||||
break;
|
||||
len = strlen (key);
|
||||
}
|
||||
if (key)
|
||||
katze_assign (desc_title, NULL);
|
||||
|
|
|
@ -570,23 +570,6 @@ midori_panel_new (void)
|
|||
return GTK_WIDGET (panel);
|
||||
}
|
||||
|
||||
/**
|
||||
* midori_panel_set_compact:
|
||||
* @compact: %TRUE if the panel should be compact
|
||||
*
|
||||
* Determines if the panel should be compact.
|
||||
*
|
||||
* Deprecated: 0.1.9
|
||||
**/
|
||||
void
|
||||
midori_panel_set_compact (MidoriPanel* panel,
|
||||
gboolean compact)
|
||||
{
|
||||
g_return_if_fail (MIDORI_IS_PANEL (panel));
|
||||
|
||||
g_object_set (panel, "show-titles", !compact, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* midori_panel_set_right_aligned:
|
||||
* @right_aligned: %TRUE if the panel should be aligned to the right
|
||||
|
|
|
@ -42,10 +42,6 @@ midori_panel_get_type (void) G_GNUC_CONST;
|
|||
GtkWidget*
|
||||
midori_panel_new (void);
|
||||
|
||||
void
|
||||
midori_panel_set_compact (MidoriPanel* panel,
|
||||
gboolean compact);
|
||||
|
||||
void
|
||||
midori_panel_set_right_aligned (MidoriPanel* panel,
|
||||
gboolean right_aligned);
|
||||
|
|
|
@ -420,7 +420,6 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
|||
#endif
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||
FRAME_NEW (_("Spell Checking"));
|
||||
/* FIXME: Provide a nice dictionary selection */
|
||||
button = katze_property_proxy (settings, "enable-spell-checking", NULL);
|
||||
gtk_button_set_label (GTK_BUTTON (button), _("Enable Spell Checking"));
|
||||
gtk_widget_set_tooltip_text (button, _("Enable spell checking while typing"));
|
||||
|
|
|
@ -436,7 +436,6 @@ midori_search_action_icon_released_cb (GtkWidget* entry,
|
|||
{
|
||||
KatzeArray* search_engines;
|
||||
GtkWidget* menu;
|
||||
guint i;
|
||||
GtkWidget* menuitem;
|
||||
KatzeItem* item;
|
||||
GdkPixbuf* icon;
|
||||
|
@ -447,10 +446,9 @@ midori_search_action_icon_released_cb (GtkWidget* entry,
|
|||
|
||||
search_engines = MIDORI_SEARCH_ACTION (action)->search_engines;
|
||||
menu = gtk_menu_new ();
|
||||
i = 0;
|
||||
if ((item = katze_array_get_nth_item (search_engines, i)))
|
||||
if (!katze_array_is_empty (search_engines))
|
||||
{
|
||||
do
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, search_engines)
|
||||
{
|
||||
const gchar* icon_name;
|
||||
|
||||
|
@ -477,7 +475,6 @@ midori_search_action_icon_released_cb (GtkWidget* entry,
|
|||
G_CALLBACK (midori_search_action_engine_activate_cb), action);
|
||||
gtk_widget_show (menuitem);
|
||||
}
|
||||
while ((item = katze_array_get_nth_item (search_engines, ++i)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1304,7 +1301,7 @@ midori_search_action_get_dialog (MidoriSearchAction* search_action)
|
|||
gtk_box_pack_start (GTK_BOX (hbox), scrolled, TRUE, TRUE, 5);
|
||||
i = 0;
|
||||
if (search_action->search_engines)
|
||||
while ((item = katze_array_get_nth_item (search_action->search_engines, i)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, search_action->search_engines)
|
||||
gtk_list_store_insert_with_values (GTK_LIST_STORE (liststore),
|
||||
NULL, i++, 0, item, -1);
|
||||
g_object_unref (liststore);
|
||||
|
|
|
@ -1053,7 +1053,6 @@ webkit_web_view_progress_changed_cb (WebKitWebView* web_view,
|
|||
g_object_notify (G_OBJECT (view), "progress");
|
||||
}
|
||||
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 14)
|
||||
static void
|
||||
midori_view_web_view_resource_request_cb (WebKitWebView* web_view,
|
||||
|
@ -1158,6 +1157,7 @@ midori_view_load_alternate_string (MidoriView* view,
|
|||
#endif
|
||||
}
|
||||
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||
static gboolean
|
||||
midori_view_display_error (MidoriView* view,
|
||||
const gchar* uri,
|
||||
|
@ -1669,7 +1669,6 @@ static void
|
|||
midori_web_view_menu_web_app_activate_cb (GtkWidget* widget,
|
||||
MidoriView* view)
|
||||
{
|
||||
/* FIXME: Use the same binary that is running right now */
|
||||
sokoke_spawn_program ("midori -a", view->link_uri, FALSE);
|
||||
}
|
||||
|
||||
|
@ -2226,7 +2225,7 @@ midori_view_populate_popup (MidoriView* view,
|
|||
gtk_menu_shell_insert (menu_shell, menuitem, 1);
|
||||
|
||||
search_engines = katze_object_get_object (window, "search-engines");
|
||||
while ((item = katze_array_get_nth_item (search_engines, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, search_engines)
|
||||
{
|
||||
GdkPixbuf* pixbuf;
|
||||
const gchar* icon_name;
|
||||
|
@ -2246,11 +2245,12 @@ midori_view_populate_popup (MidoriView* view,
|
|||
gtk_image_menu_item_set_always_show_image (
|
||||
GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
|
||||
#endif
|
||||
gtk_menu_shell_insert (GTK_MENU_SHELL (sub_menu), menuitem, i - 1);
|
||||
gtk_menu_shell_insert (GTK_MENU_SHELL (sub_menu), menuitem, i);
|
||||
g_object_set_data (G_OBJECT (menuitem), "search",
|
||||
(gchar*)katze_item_get_uri (item));
|
||||
g_signal_connect (menuitem, "activate",
|
||||
G_CALLBACK (midori_web_view_menu_search_web_activate_cb), view);
|
||||
i++;
|
||||
}
|
||||
g_object_unref (search_engines);
|
||||
}
|
||||
|
@ -2526,9 +2526,8 @@ webkit_web_view_create_web_view_cb (GtkWidget* web_view,
|
|||
new_view = view;
|
||||
else
|
||||
{
|
||||
new_view = g_object_new (MIDORI_TYPE_VIEW,
|
||||
"settings", view->settings,
|
||||
NULL);
|
||||
new_view = (MidoriView*)midori_view_new_with_uri (NULL, NULL,
|
||||
view->settings);
|
||||
midori_view_construct_web_view (new_view);
|
||||
g_signal_connect (new_view->web_view, "web-view-ready",
|
||||
G_CALLBACK (webkit_web_view_web_view_ready_cb), view);
|
||||
|
@ -2971,11 +2970,13 @@ midori_view_focus_in_event (GtkWidget* widget,
|
|||
|
||||
/**
|
||||
* midori_view_new:
|
||||
* @net: a #KatzeNet, or %NULL
|
||||
* @net: %NULL
|
||||
*
|
||||
* Creates a new view.
|
||||
*
|
||||
* Return value: a new #MidoriView
|
||||
*
|
||||
* Deprecated: 0.2.8: Use midori_view_new_with_uri() instead.
|
||||
**/
|
||||
GtkWidget*
|
||||
midori_view_new (KatzeNet* net)
|
||||
|
@ -3008,6 +3009,41 @@ _midori_view_update_settings (MidoriView* view)
|
|||
g_object_set (view->scrolled_window, "kinetic-scrolling", kinetic_scrolling, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* midori_view_new_with_uri:
|
||||
* @uri: an URI string, or %NULL
|
||||
* @title: a title, or %NULL
|
||||
* @settings: a #MidoriWebSettings, or %NULL
|
||||
*
|
||||
* Creates a new view with the specified parameters that
|
||||
* is visible by default.
|
||||
*
|
||||
* Return value: a new #MidoriView
|
||||
*
|
||||
* Since: 0.2.8
|
||||
**/
|
||||
GtkWidget*
|
||||
midori_view_new_with_uri (const gchar* uri,
|
||||
const gchar* title,
|
||||
MidoriWebSettings* settings)
|
||||
{
|
||||
MidoriView* view = g_object_new (MIDORI_TYPE_VIEW, NULL);
|
||||
view->title = g_strdup (title);
|
||||
if (title != NULL)
|
||||
midori_view_update_title (view);
|
||||
if (settings)
|
||||
{
|
||||
view->settings = g_object_ref (settings);
|
||||
_midori_view_update_settings (view);
|
||||
g_signal_connect (settings, "notify",
|
||||
G_CALLBACK (midori_view_settings_notify_cb), view);
|
||||
}
|
||||
if (uri != NULL)
|
||||
midori_view_set_uri (view, uri);
|
||||
gtk_widget_show ((GtkWidget*)view);
|
||||
return (GtkWidget*)view;
|
||||
}
|
||||
|
||||
static void
|
||||
midori_view_settings_notify_cb (MidoriWebSettings* settings,
|
||||
GParamSpec* pspec,
|
||||
|
@ -3606,6 +3642,7 @@ midori_view_set_uri (MidoriView* view,
|
|||
g_object_notify (G_OBJECT (view), "uri");
|
||||
return;
|
||||
}
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||
else if (g_str_has_prefix (uri, "pause:"))
|
||||
{
|
||||
gchar* title;
|
||||
|
@ -3622,6 +3659,7 @@ midori_view_set_uri (MidoriView* view,
|
|||
katze_item_set_uri (view->item, uri);
|
||||
g_object_notify (G_OBJECT (view), "uri");
|
||||
}
|
||||
#endif
|
||||
else if (g_str_has_prefix (uri, "javascript:"))
|
||||
{
|
||||
gboolean result;
|
||||
|
@ -3644,6 +3682,7 @@ midori_view_set_uri (MidoriView* view,
|
|||
{
|
||||
katze_assign (view->uri, sokoke_format_uri_for_display (uri));
|
||||
katze_item_set_uri (view->item, uri);
|
||||
katze_item_set_meta_integer (view->item, "delay", -1);
|
||||
g_object_notify (G_OBJECT (view), "uri");
|
||||
webkit_web_view_open (WEBKIT_WEB_VIEW (view->web_view), uri);
|
||||
}
|
||||
|
@ -3931,11 +3970,9 @@ midori_view_tab_label_menu_duplicate_tab_cb (GtkWidget* menuitem,
|
|||
MidoriView* view)
|
||||
{
|
||||
MidoriNewView where = MIDORI_NEW_VIEW_TAB;
|
||||
GtkWidget* new_view = g_object_new (MIDORI_TYPE_VIEW,
|
||||
"settings", view->settings, NULL);
|
||||
midori_view_set_uri (MIDORI_VIEW (new_view),
|
||||
midori_view_get_display_uri (view));
|
||||
gtk_widget_show (new_view);
|
||||
GtkWidget* new_view = midori_view_new_with_uri (
|
||||
midori_view_get_display_uri (view),
|
||||
NULL, view->settings);
|
||||
g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where);
|
||||
}
|
||||
|
||||
|
@ -4017,7 +4054,7 @@ midori_view_get_tab_menu (MidoriView* view)
|
|||
g_signal_connect (menuitem, "activate",
|
||||
G_CALLBACK (midori_view_tab_label_menu_duplicate_tab_cb), view);
|
||||
menuitem = gtk_menu_item_new_with_mnemonic (
|
||||
view->minimized ? _("_Restore Tab") : _("_Minimize Tab"));
|
||||
view->minimized ? _("Show Tab _Label") : _("Show Tab _Icon Only"));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
g_signal_connect (menuitem, "activate",
|
||||
G_CALLBACK (midori_view_tab_label_menu_minimize_tab_cb), view);
|
||||
|
@ -4454,6 +4491,7 @@ midori_view_reload (MidoriView* view,
|
|||
webkit_web_view_reload (WEBKIT_WEB_VIEW (view->web_view));
|
||||
else
|
||||
webkit_web_view_reload_bypass_cache (WEBKIT_WEB_VIEW (view->web_view));
|
||||
katze_item_set_meta_integer (view->item, "delay", -1);
|
||||
|
||||
g_free (title);
|
||||
}
|
||||
|
|
|
@ -80,6 +80,11 @@ midori_view_get_type (void) G_GNUC_CONST;
|
|||
GtkWidget*
|
||||
midori_view_new (KatzeNet* net);
|
||||
|
||||
GtkWidget*
|
||||
midori_view_new_with_uri (const gchar* uri,
|
||||
const gchar* title,
|
||||
MidoriWebSettings* settings);
|
||||
|
||||
void
|
||||
midori_view_set_settings (MidoriView* view,
|
||||
MidoriWebSettings* settings);
|
||||
|
|
|
@ -97,8 +97,6 @@ midori_viewable_base_init (MidoriViewableIface* iface)
|
|||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_MENU);
|
||||
|
||||
iface->p = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
|
||||
iface->get_stock_id = midori_viewable_default_get_stock_id;
|
||||
iface->get_label = midori_viewable_default_get_label;
|
||||
iface->get_toolbar = midori_viewable_default_get_toolbar;
|
||||
|
@ -109,137 +107,6 @@ midori_viewable_base_init (MidoriViewableIface* iface)
|
|||
static void
|
||||
midori_viewable_base_finalize (MidoriViewableIface* iface)
|
||||
{
|
||||
g_hash_table_destroy (iface->p);
|
||||
}
|
||||
|
||||
/**
|
||||
* midori_viewable_new_from_uri:
|
||||
* @uri: an URI
|
||||
*
|
||||
* Attempts to create a new #MidoriViewable from the specified URI.
|
||||
*
|
||||
* The protocol of @uri must previously have been registered by
|
||||
* the #MidoriViewable via midori_viewable_register_protocol().
|
||||
*
|
||||
* Return value: a new #MidoriViewable, or %NULL
|
||||
*
|
||||
* Deprecated: 0.2.6
|
||||
**/
|
||||
GtkWidget*
|
||||
midori_viewable_new_from_uri (const gchar* uri)
|
||||
{
|
||||
MidoriViewableIface* iface;
|
||||
gchar** parts;
|
||||
gchar* type_name;
|
||||
GType type;
|
||||
|
||||
if (!(iface = g_type_default_interface_peek (MIDORI_TYPE_VIEWABLE)))
|
||||
{
|
||||
g_warning ("No viewable interface available");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (uri != NULL, NULL);
|
||||
|
||||
if (!g_hash_table_size (iface->p))
|
||||
return NULL;
|
||||
|
||||
if ((parts = g_strsplit (uri, "://", 2)))
|
||||
{
|
||||
if (!(type_name = g_hash_table_lookup (iface->p, parts[0])))
|
||||
{
|
||||
/* FIXME: Support midori://dummy/foo */
|
||||
|
||||
type_name = g_hash_table_lookup (iface->p, uri);
|
||||
}
|
||||
g_strfreev (parts);
|
||||
if (type_name)
|
||||
{
|
||||
type = g_type_from_name (type_name);
|
||||
g_free (type_name);
|
||||
if (type)
|
||||
return g_object_new (type, "uri", uri, NULL);
|
||||
}
|
||||
}
|
||||
else if ((parts = g_strsplit_set (uri, ":", 2)))
|
||||
{
|
||||
type_name = g_hash_table_lookup (iface->p, parts[0]);
|
||||
g_strfreev (parts);
|
||||
if (type_name)
|
||||
{
|
||||
type = g_type_from_name (type_name);
|
||||
g_free (type_name);
|
||||
if (type)
|
||||
return g_object_new (type, "uri", uri, NULL);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
viewable_type_implements (GType type,
|
||||
GType interface)
|
||||
{
|
||||
GType *interfaces;
|
||||
guint i;
|
||||
|
||||
if (!(interfaces = g_type_interfaces (type, NULL)))
|
||||
return FALSE;
|
||||
for (i = 0; interfaces[i]; i++)
|
||||
{
|
||||
if (interfaces[i] == interface)
|
||||
{
|
||||
g_free (interfaces);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
g_free (interfaces);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* midori_viewable_register_protocol:
|
||||
* @type: a type that implements #MidoriViewable
|
||||
* @protocol: a protocol
|
||||
*
|
||||
* Registers the specified protocol as supported by @type.
|
||||
*
|
||||
* The following kinds of protocols are supported:
|
||||
*
|
||||
* "dummy": support URIs like "dummy://foo/bar"
|
||||
* "about:dummy": support URIs like "about:dummy"
|
||||
* FIXME: The following is not yet fully supported
|
||||
* "midori://dummy": support URIs like "midori://dummy/foo"
|
||||
*
|
||||
* Return value: a new #MidoriViewable, or %NULL
|
||||
*
|
||||
* Deprecated: 0.2.6
|
||||
**/
|
||||
void
|
||||
midori_viewable_register_protocol (GType type,
|
||||
const gchar* protocol)
|
||||
{
|
||||
MidoriViewableIface* iface;
|
||||
GObjectClass* class;
|
||||
|
||||
if (!(iface = g_type_default_interface_peek (MIDORI_TYPE_VIEWABLE)))
|
||||
{
|
||||
g_warning ("No viewable interface available");
|
||||
return;
|
||||
}
|
||||
|
||||
g_return_if_fail (viewable_type_implements (type, MIDORI_TYPE_VIEWABLE));
|
||||
|
||||
if (!(class = g_type_class_peek (type)))
|
||||
{
|
||||
g_warning ("No class for %s available", g_type_name (type));
|
||||
return;
|
||||
}
|
||||
g_return_if_fail (g_object_class_find_property (class, "uri"));
|
||||
/* FIXME: Verify the syntax of protocol */
|
||||
|
||||
g_hash_table_insert (iface->p, g_strdup (protocol),
|
||||
g_strdup (g_type_name (type)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#ifndef __MIDORI_VIEWABLE_H__
|
||||
#define __MIDORI_VIEWABLE_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <katze/katze.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -44,21 +42,11 @@ struct _MidoriViewableIface
|
|||
|
||||
GtkWidget*
|
||||
(*get_toolbar) (MidoriViewable* viewable);
|
||||
|
||||
/* Private data */
|
||||
gpointer p;
|
||||
};
|
||||
|
||||
GType
|
||||
midori_viewable_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget*
|
||||
midori_viewable_new_from_uri (const gchar* uri);
|
||||
|
||||
void
|
||||
midori_viewable_register_protocol (GType type,
|
||||
const gchar* protocol);
|
||||
|
||||
const gchar*
|
||||
midori_viewable_get_stock_id (MidoriViewable* viewable);
|
||||
|
||||
|
|
|
@ -200,7 +200,9 @@ midori_startup_get_type (void)
|
|||
{ MIDORI_STARTUP_BLANK_PAGE, "MIDORI_STARTUP_BLANK_PAGE", N_("Show Blank page") },
|
||||
{ MIDORI_STARTUP_HOMEPAGE, "MIDORI_STARTUP_HOMEPAGE", N_("Show Homepage") },
|
||||
{ MIDORI_STARTUP_LAST_OPEN_PAGES, "MIDORI_STARTUP_LAST_OPEN_PAGES", N_("Show last open tabs") },
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||
{ MIDORI_STARTUP_DELAYED_PAGES, "MIDORI_STARTUP_DELAYED_PAGES", N_("Show last tabs without loading") },
|
||||
#endif
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
type = g_enum_register_static ("MidoriStartup", values);
|
||||
|
|
|
@ -66,7 +66,9 @@ typedef enum
|
|||
MIDORI_STARTUP_BLANK_PAGE, /* One blank tab or speed dial is opened */
|
||||
MIDORI_STARTUP_HOMEPAGE, /* One homepage tab is opened */
|
||||
MIDORI_STARTUP_LAST_OPEN_PAGES, /* The session is loaded and saved */
|
||||
#if WEBKIT_CHECK_VERSION (1, 1, 6)
|
||||
MIDORI_STARTUP_DELAYED_PAGES /* The session is saved, loading pages is delayed */
|
||||
#endif
|
||||
} MidoriStartup;
|
||||
|
||||
GType
|
||||
|
|
|
@ -1301,15 +1301,15 @@ sokoke_register_stock_items (void)
|
|||
{ STOCK_TRANSFER, NULL, 0, 0, GTK_STOCK_SAVE },
|
||||
|
||||
{ STOCK_BOOKMARK, N_("_Bookmark"), 0, 0, GTK_STOCK_FILE },
|
||||
{ STOCK_BOOKMARKS, N_("_Bookmarks"), GDK_CONTROL_MASK, GDK_B, GTK_STOCK_DIRECTORY },
|
||||
{ STOCK_BOOKMARKS, N_("_Bookmarks"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_B, GTK_STOCK_DIRECTORY },
|
||||
{ STOCK_BOOKMARK_ADD, N_("Add Boo_kmark"), 0, 0, GTK_STOCK_ADD },
|
||||
{ STOCK_CONSOLE, N_("_Console"), 0, 0, GTK_STOCK_DIALOG_WARNING },
|
||||
{ STOCK_EXTENSIONS, N_("_Extensions"), 0, 0, GTK_STOCK_CONVERT },
|
||||
{ STOCK_HISTORY, N_("_History"), 0, GDK_H, GTK_STOCK_SORT_ASCENDING },
|
||||
{ STOCK_HISTORY, N_("_History"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_H, GTK_STOCK_SORT_ASCENDING },
|
||||
{ STOCK_HOMEPAGE, N_("_Homepage"), 0, 0, GTK_STOCK_HOME },
|
||||
{ STOCK_SCRIPTS, N_("_Userscripts"), 0, 0, GTK_STOCK_EXECUTE },
|
||||
{ STOCK_TAB_NEW, N_("New _Tab"), 0, 0, GTK_STOCK_ADD },
|
||||
{ STOCK_TRANSFERS, N_("_Transfers"), 0, GDK_J, GTK_STOCK_SAVE },
|
||||
{ STOCK_TRANSFERS, N_("_Transfers"), GDK_CONTROL_MASK | GDK_SHIFT_MASK, GDK_J, GTK_STOCK_SAVE },
|
||||
{ STOCK_PLUGINS, N_("Netscape p_lugins"), 0, 0, GTK_STOCK_CONVERT },
|
||||
{ STOCK_USER_TRASH, N_("_Closed Tabs"), 0, 0, "gtk-undo-ltr" },
|
||||
{ STOCK_WINDOW_NEW, N_("New _Window"), 0, 0, GTK_STOCK_ADD },
|
||||
|
|
|
@ -131,13 +131,12 @@ midori_bookmarks_export_array_db (sqlite3* db,
|
|||
KatzeArray* root_array;
|
||||
KatzeArray* subarray;
|
||||
KatzeItem* item;
|
||||
int i = 0;
|
||||
|
||||
sqlcmd = g_strdup_printf ("SELECT * FROM bookmarks where folder='%s'", folder);
|
||||
root_array = katze_array_from_sqlite (db, sqlcmd);
|
||||
g_free (sqlcmd);
|
||||
|
||||
while ((item = katze_array_get_nth_item (KATZE_ARRAY (root_array), i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, root_array)
|
||||
{
|
||||
if (KATZE_ITEM_IS_FOLDER (item))
|
||||
{
|
||||
|
@ -156,17 +155,12 @@ midori_bookmarks_import_array_db (sqlite3* db,
|
|||
KatzeArray* array,
|
||||
const gchar* folder)
|
||||
{
|
||||
GList* list = NULL;
|
||||
GList* bookmarks;
|
||||
|
||||
bookmarks = katze_array_get_items ((KatzeArray*)array);
|
||||
for (list = bookmarks; list != NULL; list = g_list_next (list))
|
||||
{
|
||||
KatzeItem* item;
|
||||
|
||||
if (KATZE_IS_ARRAY (list->data))
|
||||
midori_bookmarks_import_array_db (db, list->data, folder);
|
||||
item = (KatzeItem*) list->data;
|
||||
KATZE_ARRAY_FOREACH_ITEM (item, array)
|
||||
{
|
||||
if (KATZE_IS_ARRAY (item))
|
||||
midori_bookmarks_import_array_db (db, KATZE_ARRAY (item), folder);
|
||||
midori_bookmarks_insert_item_db (db, item, folder);
|
||||
}
|
||||
}
|
||||
|
@ -660,11 +654,10 @@ midori_bookmarks_open_in_tab_activate_cb (GtkWidget* menuitem,
|
|||
{
|
||||
KatzeItem* child;
|
||||
KatzeArray* array;
|
||||
guint i = 0;
|
||||
|
||||
array = midori_bookmarks_read_from_db (bookmarks, katze_item_get_name (item), NULL);
|
||||
g_return_if_fail (KATZE_IS_ARRAY (array));
|
||||
while ((child = katze_array_get_nth_item (KATZE_ARRAY (array), i)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (child, array)
|
||||
{
|
||||
if ((uri = katze_item_get_uri (child)) && *uri)
|
||||
{
|
||||
|
@ -674,7 +667,6 @@ midori_bookmarks_open_in_tab_activate_cb (GtkWidget* menuitem,
|
|||
n = midori_browser_add_item (browser, child);
|
||||
midori_browser_set_current_page_smartly (browser, n);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else if ((uri = katze_item_get_uri (item)) && *uri)
|
||||
|
|
|
@ -59,6 +59,9 @@ midori_console_get_property (GObject* object,
|
|||
GValue* value,
|
||||
GParamSpec* pspec);
|
||||
|
||||
static GtkWidget*
|
||||
midori_console_get_toolbar (MidoriViewable* console);
|
||||
|
||||
static void
|
||||
midori_console_class_init (MidoriConsoleClass* class)
|
||||
{
|
||||
|
@ -327,22 +330,9 @@ midori_console_new (void)
|
|||
return GTK_WIDGET (console);
|
||||
}
|
||||
|
||||
/**
|
||||
* midori_console_get_toolbar:
|
||||
* @console: a #MidoriConsole
|
||||
*
|
||||
* Retrieves the toolbar of the console. A new widget is created on
|
||||
* the first call of this function.
|
||||
*
|
||||
* Return value: a toolbar widget
|
||||
*
|
||||
* Deprecated: 0.1.2: Use midori_viewable_get_toolbar() instead.
|
||||
**/
|
||||
GtkWidget*
|
||||
static GtkWidget*
|
||||
midori_console_get_toolbar (MidoriViewable* console)
|
||||
{
|
||||
g_return_val_if_fail (MIDORI_IS_CONSOLE (console), NULL);
|
||||
|
||||
if (!MIDORI_CONSOLE (console)->toolbar)
|
||||
{
|
||||
GtkWidget* toolbar;
|
||||
|
|
|
@ -42,9 +42,6 @@ midori_console_get_type (void);
|
|||
GtkWidget*
|
||||
midori_console_new (void);
|
||||
|
||||
GtkWidget*
|
||||
midori_console_get_toolbar (MidoriViewable* console);
|
||||
|
||||
void
|
||||
midori_console_add (MidoriConsole* console,
|
||||
const gchar* message,
|
||||
|
|
|
@ -167,7 +167,6 @@ midori_extensions_set_property (GObject* object,
|
|||
{
|
||||
KatzeArray* array;
|
||||
MidoriExtension* extension;
|
||||
guint i;
|
||||
|
||||
/* FIXME: Handle NULL and subsequent assignments */
|
||||
extensions->app = g_value_get_object (value);
|
||||
|
@ -175,8 +174,7 @@ midori_extensions_set_property (GObject* object,
|
|||
g_signal_connect (array, "add-item",
|
||||
G_CALLBACK (midori_extensions_add_item_cb), extensions);
|
||||
|
||||
i = 0;
|
||||
while ((extension = katze_array_get_nth_item (array, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (extension, array)
|
||||
midori_extensions_add_item_cb (array, extension, extensions);
|
||||
|
||||
/* Hide if there are no extensions at all */
|
||||
|
@ -379,10 +377,9 @@ midori_extensions_finalize (GObject* object)
|
|||
{
|
||||
MidoriExtensions* extensions = MIDORI_EXTENSIONS (object);
|
||||
KatzeArray* array = katze_object_get_object (extensions->app, "extensions");
|
||||
guint i = 0;
|
||||
MidoriExtension* extension;
|
||||
|
||||
while ((extension = katze_array_get_nth_item (array, i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (extension, array)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (extension,
|
||||
midori_extensions_extension_activate_cb, extensions);
|
||||
|
|
|
@ -136,21 +136,21 @@ midori_history_format_date (KatzeItem *item)
|
|||
|
||||
/* A negative age is a date in the future, the clock is probably off */
|
||||
if (age < -1)
|
||||
;
|
||||
sdate = g_strdup ("");
|
||||
else if (age > 7 || age < 0)
|
||||
{
|
||||
strftime (token, sizeof (token), "%x", localtime ((time_t*)&day));
|
||||
sdate = g_strdup (token);
|
||||
}
|
||||
else if (age > 6)
|
||||
sdate = _("A week ago");
|
||||
sdate = g_strdup (_("A week ago"));
|
||||
else if (age > 1)
|
||||
sdate = g_strdup_printf (ngettext ("%d day ago",
|
||||
"%d days ago", (gint)age), (gint)age);
|
||||
else if (age == 0)
|
||||
sdate = _("Today");
|
||||
sdate = g_strdup (_("Today"));
|
||||
else
|
||||
sdate = _("Yesterday");
|
||||
sdate = g_strdup (_("Yesterday"));
|
||||
return sdate;
|
||||
}
|
||||
|
||||
|
@ -563,8 +563,11 @@ midori_history_treeview_render_text_cb (GtkTreeViewColumn* column,
|
|||
g_object_set (renderer, "markup", NULL,
|
||||
"text", katze_item_get_name (item), NULL);
|
||||
else if (KATZE_ITEM_IS_FOLDER (item))
|
||||
g_object_set (renderer, "markup", NULL,
|
||||
"text", midori_history_format_date (item), NULL);
|
||||
{
|
||||
gchar* formatted = midori_history_format_date (item);
|
||||
g_object_set (renderer, "markup", NULL, "text", formatted, NULL);
|
||||
g_free (formatted);
|
||||
}
|
||||
else
|
||||
g_object_set (renderer, "markup", _("<i>Separator</i>"), NULL);
|
||||
|
||||
|
@ -665,7 +668,6 @@ midori_history_open_in_tab_activate_cb (GtkWidget* menuitem,
|
|||
gchar* sqlcmd;
|
||||
KatzeItem* child;
|
||||
KatzeArray* array;
|
||||
guint i = 0;
|
||||
|
||||
db = g_object_get_data (G_OBJECT (history->array), "db");
|
||||
sqlcmd = g_strdup_printf ("SELECT uri, title, date, day "
|
||||
|
@ -674,7 +676,7 @@ midori_history_open_in_tab_activate_cb (GtkWidget* menuitem,
|
|||
(int)katze_item_get_added (item));
|
||||
array = katze_array_from_sqlite (db, sqlcmd);
|
||||
g_free (sqlcmd);
|
||||
while ((child = katze_array_get_nth_item (KATZE_ARRAY (array), i++)))
|
||||
KATZE_ARRAY_FOREACH_ITEM (child, KATZE_ARRAY (array))
|
||||
{
|
||||
if ((uri = katze_item_get_uri (child)) && *uri)
|
||||
{
|
||||
|
|
|
@ -482,7 +482,7 @@ midori_transfers_popup (GtkWidget* widget,
|
|||
midori_transfers_open_folder_activate_cb, TRUE, transfers);
|
||||
midori_transfers_popup_menu_item (GTK_MENU (menu), GTK_STOCK_COPY,
|
||||
_("Copy Link Loc_ation"), download,
|
||||
midori_transfers_copy_address_activate_cb, FALSE, transfers);
|
||||
midori_transfers_copy_address_activate_cb, TRUE, transfers);
|
||||
|
||||
katze_widget_popup (widget, GTK_MENU (menu), event, KATZE_MENU_POSITION_CURSOR);
|
||||
}
|
||||
|
|
2287
po/pt_BR.po
2287
po/pt_BR.po
File diff suppressed because it is too large
Load diff
|
@ -83,6 +83,19 @@ midori_findbar_entry_clear_icon_released_cb (GtkIconEntry* entry,
|
|||
gtk_entry_set_text (GTK_ENTRY (entry), "");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
midori_findbar_case_sensitive (MidoriFindbar* findbar)
|
||||
{
|
||||
/* Smart case while typing: foo or fOO lowercase, Foo or FOO uppercase */
|
||||
if (findbar->find_typing)
|
||||
{
|
||||
const gchar* text = gtk_entry_get_text (GTK_ENTRY (findbar->find_text));
|
||||
return g_unichar_isupper (g_utf8_get_char (text));
|
||||
}
|
||||
return gtk_toggle_tool_button_get_active (
|
||||
GTK_TOGGLE_TOOL_BUTTON (findbar->find_case));
|
||||
}
|
||||
|
||||
void
|
||||
midori_findbar_find (MidoriFindbar* findbar,
|
||||
gboolean forward)
|
||||
|
@ -96,8 +109,7 @@ midori_findbar_find (MidoriFindbar* findbar,
|
|||
return;
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (findbar->find_text));
|
||||
case_sensitive = gtk_toggle_tool_button_get_active (
|
||||
GTK_TOGGLE_TOOL_BUTTON (findbar->find_case));
|
||||
case_sensitive = midori_findbar_case_sensitive (findbar);
|
||||
midori_view_search_text (MIDORI_VIEW (view), text, case_sensitive, forward);
|
||||
}
|
||||
|
||||
|
@ -158,7 +170,7 @@ midori_findbar_text_changed_cb (GtkWidget* entry,
|
|||
GtkWidget* view = midori_browser_get_current_tab (browser);
|
||||
const gchar* text = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
midori_view_unmark_text_matches (MIDORI_VIEW (view));
|
||||
if (g_utf8_strlen (text, -1) > 2)
|
||||
if (g_utf8_strlen (text, -1) > 1)
|
||||
midori_findbar_find (findbar, TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -315,8 +327,7 @@ midori_findbar_search_text (MidoriFindbar* findbar,
|
|||
GTK_ICON_ENTRY_PRIMARY, (found) ? GTK_STOCK_FIND : GTK_STOCK_STOP);
|
||||
#endif
|
||||
text = gtk_entry_get_text (GTK_ENTRY (findbar->find_text));
|
||||
case_sensitive = gtk_toggle_tool_button_get_active (
|
||||
GTK_TOGGLE_TOOL_BUTTON (findbar->find_case));
|
||||
case_sensitive = midori_findbar_case_sensitive (findbar);
|
||||
midori_view_mark_text_matches (MIDORI_VIEW (view), text, case_sensitive);
|
||||
highlight = gtk_toggle_tool_button_get_active (
|
||||
GTK_TOGGLE_TOOL_BUTTON (findbar->find_highlight));
|
||||
|
|
3
wscript
3
wscript
|
@ -29,12 +29,13 @@ from Configure import find_program_impl
|
|||
|
||||
major = 0
|
||||
minor = 2
|
||||
micro = 7
|
||||
micro = 8
|
||||
|
||||
APPNAME = 'midori'
|
||||
VERSION = str (major) + '.' + str (minor) + '.' + str (micro)
|
||||
|
||||
try:
|
||||
if os.path.isdir ('.git'):
|
||||
git = Utils.cmd_output (['git', 'describe'], silent=True)
|
||||
if git:
|
||||
VERSION = git.strip ()
|
||||
|
|
Loading…
Reference in a new issue