Require GTK+ 2.16 or later

This commit is contained in:
Christian Dywan 2012-07-20 01:22:38 +02:00
parent d057ab4ddb
commit 2cf8d9323e
15 changed files with 3 additions and 2169 deletions

4
README
View File

@ -11,10 +11,10 @@ Midori is a lightweight web browser.
* Straightforward bookmark management.
* Customizable interface, extensions written in C and Vala.
Requirements: GLib 2.22, GTK+ 2.10, WebkitGTK+ 1.1.17, libXML2,
Requirements: GLib 2.22, GTK+ 2.16, WebkitGTK+ 1.1.17, libXML2,
libsoup 2.27.90, sqlite 3.0, Vala 0.14
Optional: GTK+ 3.0, Unique 0.9, libnotify
Optional: GTK+ 3.0, Unique 0.9, libnotify, gcr
For installation instructions read INSTALL.

View File

@ -336,23 +336,13 @@ addons_button_add_clicked_cb (GtkToolItem* toolitem,
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;

View File

@ -702,7 +702,6 @@ static gchar *cm_get_domain_description_text(const gchar *domain, gint cookie_co
}
#if GTK_CHECK_VERSION(2, 12, 0)
static gboolean cm_tree_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_mode,
GtkTooltip *tooltip, CookieManagerPage *cmp)
{
@ -731,8 +730,6 @@ static gboolean cm_tree_query_tooltip(GtkWidget *widget, gint x, gint y, gboolea
return FALSE;
}
#endif
static gboolean cm_filter_match(const gchar *haystack, const gchar *needle)
{
@ -1045,10 +1042,8 @@ static GtkWidget *cm_tree_prepare(CookieManagerPage *cmp)
g_signal_connect(treeview, "popup-menu", G_CALLBACK(cm_tree_popup_menu_cb), cmp);
/* tooltips */
#if GTK_CHECK_VERSION(2, 12, 0)
gtk_widget_set_has_tooltip(treeview, TRUE);
g_signal_connect(treeview, "query-tooltip", G_CALLBACK(cm_tree_query_tooltip), cmp);
#endif
/* drag'n'drop */
gtk_tree_view_enable_model_drag_source(

View File

@ -143,7 +143,6 @@ midori_extension_cursor_or_row_changed_cb (GtkTreeView* treeview,
/* Nothing to do */
}
#if GTK_CHECK_VERSION (2, 12, 0)
static gboolean
tab_panel_treeview_query_tooltip_cb (GtkWidget* treeview,
gint x,
@ -171,7 +170,6 @@ tab_panel_treeview_query_tooltip_cb (GtkWidget* treeview,
return TRUE;
}
#endif
static void
midori_extension_row_activated_cb (GtkTreeView* treeview,
@ -534,11 +532,9 @@ tab_panel_app_add_browser_cb (MidoriApp* app,
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (treeview), FALSE);
#if GTK_CHECK_VERSION (2, 12, 0)
g_signal_connect (treeview, "query-tooltip",
G_CALLBACK (tab_panel_treeview_query_tooltip_cb), NULL);
gtk_widget_set_has_tooltip (treeview, TRUE);
#endif
column = gtk_tree_view_column_new ();
renderer_pixbuf = gtk_cell_renderer_pixbuf_new ();
gtk_tree_view_column_pack_start (column, renderer_pixbuf, FALSE);

View File

@ -110,41 +110,3 @@ gtk_entry_get_placeholder_text (GtkEntry* entry)
}
#endif
#if !GTK_CHECK_VERSION (2, 12, 0)
void
gtk_widget_set_has_tooltip (GtkWidget* widget,
gboolean has_tooltip)
{
/* Do nothing */
}
void
gtk_widget_set_tooltip_text (GtkWidget* widget,
const gchar* text)
{
if (text && *text)
{
static GtkTooltips* tooltips = NULL;
if (G_UNLIKELY (!tooltips))
tooltips = gtk_tooltips_new ();
gtk_tooltips_set_tip (tooltips, widget, text, NULL);
}
}
void
gtk_tool_item_set_tooltip_text (GtkToolItem* toolitem,
const gchar* text)
{
if (text && *text)
{
static GtkTooltips* tooltips = NULL;
if (G_UNLIKELY (!tooltips))
tooltips = gtk_tooltips_new ();
gtk_tool_item_set_tooltip (toolitem, tooltips, text, NULL);
}
}
#endif

View File

@ -39,25 +39,6 @@ G_BEGIN_DECLS
#define g_format_size(sz) g_format_size_for_display ((goffset)sz)
#endif
#if !GTK_CHECK_VERSION (2, 14, 0)
#define gtk_dialog_get_content_area(dlg) dlg->vbox
#define gtk_dialog_get_action_area(dlg) dlg->action_area
#define gtk_widget_get_window(wdgt) wdgt->window
#define gtk_adjustment_get_page_size(adj) adj->page_size
#define gtk_adjustment_get_upper(adj) adj->upper
#define gtk_adjustment_get_lower(adj) adj->lower
#define gtk_adjustment_get_value(adj) adj->value
#endif
#if !GTK_CHECK_VERSION (2, 16, 0)
#define GTK_ACTIVATABLE GTK_WIDGET
#define gtk_activatable_get_related_action gtk_widget_get_action
#define gtk_menu_item_set_label(menuitem, label) \
gtk_label_set_label (GTK_LABEL (GTK_BIN (menuitem)->child), \
label ? label : "");
#define gtk_image_menu_item_set_always_show_image(menuitem, yesno) ()
#endif
#if !GTK_CHECK_VERSION (2, 18, 0)
#define gtk_widget_is_toplevel(widget) GTK_WIDGET_TOPLEVEL (widget)
#define gtk_widget_has_focus(widget) GTK_WIDGET_HAS_FOCUS (widget)
@ -95,22 +76,6 @@ G_BEGIN_DECLS
const gchar* gtk_entry_get_placeholder_text (GtkEntry* entry);
#endif
#if !GTK_CHECK_VERSION(2, 12, 0)
void
gtk_widget_set_has_tooltip (GtkWidget* widget,
gboolean has_tooltip);
void
gtk_widget_set_tooltip_text (GtkWidget* widget,
const gchar* text);
void
gtk_tool_item_set_tooltip_text (GtkToolItem* toolitem,
const gchar* text);
#endif
#if !GTK_CHECK_VERSION (2, 24 ,0)
#define gtk_combo_box_text_append_text gtk_combo_box_append_text
#define gtk_combo_box_text_new gtk_combo_box_new_text

View File

@ -277,7 +277,6 @@ proxy_combo_box_changed_cb (GtkComboBox* button,
if (custom_value)
{
#if GTK_CHECK_VERSION (2, 12, 0)
if (value == custom_value)
gtk_widget_set_tooltip_text (GTK_WIDGET (button), NULL);
else
@ -286,7 +285,6 @@ proxy_combo_box_changed_cb (GtkComboBox* button,
gtk_widget_set_tooltip_text (GTK_WIDGET (button), custom_text);
g_free (custom_text);
}
#endif
}
}
#endif
@ -523,14 +521,8 @@ katze_property_proxy (gpointer object,
string = g_strdup (G_PARAM_SPEC_STRING (pspec)->default_value);
gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (widget),
string ? string : "");
#if GTK_CHECK_VERSION (2, 12, 0)
g_signal_connect (widget, "file-set",
G_CALLBACK (proxy_uri_file_set_cb), object);
#else
if (pspec->flags & G_PARAM_WRITABLE)
g_signal_connect (widget, "selection-changed",
G_CALLBACK (proxy_uri_file_set_cb), object);
#endif
}
else if (type == G_TYPE_PARAM_STRING && (_hint == I_("font")
|| _hint == I_("font-monospace")))
@ -819,10 +811,8 @@ katze_property_proxy (gpointer object,
g_object_set_data_full (G_OBJECT (entry), "property",
g_strdup (custom), g_free);
}
#if GTK_CHECK_VERSION (2, 12, 0)
else
gtk_widget_set_tooltip_text (widget, custom_text);
#endif
g_free (custom_text);
@ -837,10 +827,8 @@ katze_property_proxy (gpointer object,
widget = gtk_label_new (gettext (nick));
g_free (string);
#if GTK_CHECK_VERSION (2, 12, 0)
if (!gtk_widget_get_tooltip_text (widget))
gtk_widget_set_tooltip_text (widget, g_param_spec_get_blurb (pspec));
#endif
gtk_widget_set_sensitive (widget, pspec->flags & G_PARAM_WRITABLE);
g_object_set_data_full (G_OBJECT (widget), "property",
@ -888,9 +876,7 @@ katze_property_label (gpointer object,
nick = g_param_spec_get_nick (pspec);
widget = gtk_label_new (nick);
#if GTK_CHECK_VERSION (2, 12, 0)
gtk_widget_set_tooltip_text (widget, g_param_spec_get_blurb (pspec));
#endif
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
return widget;
@ -1583,10 +1569,8 @@ katze_uri_entry_new (GtkWidget* other_widget)
{
GtkWidget* entry = gtk_entry_new ();
#if GTK_CHECK_VERSION (2, 16, 0)
gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY,
g_themed_icon_new_with_default_fallbacks ("text-html-symbolic"));
#endif
g_signal_connect (entry, "changed",
G_CALLBACK (katze_uri_entry_changed_cb), other_widget);
return entry;

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,6 @@
G_BEGIN_DECLS
#if GTK_CHECK_VERSION (2, 16, 0)
#define GtkIconEntry GtkEntry
#define GtkIconEntryPosition GtkEntryIconPosition
#define GTK_ICON_ENTRY_PRIMARY GTK_ENTRY_ICON_PRIMARY
@ -45,99 +44,6 @@ G_BEGIN_DECLS
#define gtk_icon_entry_get_tooltip gtk_entry_get_icon_tooltip_text
#define gtk_icon_entry_set_icon_highlight gtk_entry_set_icon_activatable
#define gtk_icon_entry_set_progress_fraction gtk_entry_set_progress_fraction
#else
#define GTK_TYPE_ICON_ENTRY (gtk_icon_entry_get_type())
#define GTK_ICON_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_ICON_ENTRY, GtkIconEntry))
#define GTK_ICON_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_ICON_ENTRY, GtkIconEntryClass))
#define GTK_IS_ICON_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_ICON_ENTRY))
#define GTK_IS_ICON_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_ICON_ENTRY))
#define GTK_ICON_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_ENTRY, GtkIconEntryClass))
typedef enum
{
GTK_ICON_ENTRY_PRIMARY,
GTK_ICON_ENTRY_SECONDARY
} GtkIconEntryPosition;
typedef struct _GtkIconEntry GtkIconEntry;
typedef struct _GtkIconEntryClass GtkIconEntryClass;
typedef struct _GtkIconEntryPrivate GtkIconEntryPrivate;
struct _GtkIconEntry
{
GtkEntry parent_object;
GtkIconEntryPrivate* priv;
};
struct _GtkIconEntryClass
{
GtkEntryClass parent_class;
/* Signals */
void (*icon_pressed) (GtkIconEntry *entry,
GtkIconEntryPosition icon_pos,
int button);
void (*icon_released) (GtkIconEntry *entry,
GtkIconEntryPosition icon_pos,
int button);
void (*gtk_reserved1) (void);
void (*gtk_reserved2) (void);
void (*gtk_reserved3) (void);
void (*gtk_reserved4) (void);
};
GType gtk_icon_entry_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_icon_entry_new (void);
void gtk_icon_entry_set_icon_from_pixbuf (GtkIconEntry *entry,
GtkIconEntryPosition icon_pos,
GdkPixbuf *pixbuf);
void gtk_icon_entry_set_icon_from_stock (GtkIconEntry *entry,
GtkIconEntryPosition icon_pos,
const gchar *stock_id);
void gtk_icon_entry_set_icon_from_icon_name (GtkIconEntry *entry,
GtkIconEntryPosition icon_pos,
const gchar *icon_name);
void gtk_icon_entry_set_icon_from_gicon (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos,
GIcon *icon);
GdkPixbuf* gtk_icon_entry_get_pixbuf (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos);
GIcon* gtk_icon_entry_get_gicon (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos);
void gtk_icon_entry_set_icon_highlight (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos,
gboolean highlight);
gboolean gtk_icon_entry_get_icon_highlight (const GtkIconEntry *entry,
GtkIconEntryPosition icon_pos);
void gtk_icon_entry_set_cursor (const GtkIconEntry *icon_entry,
GtkIconEntryPosition icon_pos,
GdkCursorType cursor_type);
const gchar* gtk_icon_entry_get_tooltip (const GtkIconEntry *icon_entry,
GtkIconEntryPosition icon_pos);
void gtk_icon_entry_set_tooltip (const GtkIconEntry *icon_entry,
GtkIconEntryPosition icon_pos,
const gchar *text);
void gtk_icon_entry_set_icon_sensitive (const GtkIconEntry *icon_entry,
GtkIconEntryPosition icon_pos,
gboolean sensitive);
void gtk_icon_entry_set_progress_fraction (GtkIconEntry *icon_entry,
gdouble fraction);
#endif
G_END_DECLS

View File

@ -2658,11 +2658,7 @@ _action_compact_add_activate (GtkAction* action,
g_free (label);
gtk_widget_set_name (button, "GtkButton-thumb");
gtk_box_pack_start (box, button, TRUE, TRUE, 4);
#if GTK_CHECK_VERSION (2, 16, 0)
gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), action);
#else
gtk_action_connect_proxy (action, button);
#endif
g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gtk_widget_destroy), dialog);
}

View File

@ -1342,13 +1342,8 @@ midori_location_action_icon_released_cb (GtkWidget* widget,
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
#endif
hbox = gtk_hbox_new (FALSE, 0);
#if GTK_CHECK_VERSION (2, 16, 0)
gtk_box_pack_start (GTK_BOX (hbox), gtk_image_new_from_gicon (
gtk_entry_get_icon_gicon (GTK_ENTRY (widget), icon_pos), GTK_ICON_SIZE_DIALOG), FALSE, FALSE, 0);
#else
gtk_box_pack_start (GTK_BOX (hbox),
gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG), FALSE, FALSE, 0);
#endif
gtk_box_pack_start (GTK_BOX (hbox),
gtk_label_new (gtk_icon_entry_get_tooltip (GTK_ICON_ENTRY (widget), icon_pos)), FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 0);
@ -1920,36 +1915,24 @@ midori_location_action_set_security_hint (MidoriLocationAction* location_action,
if (hint == MIDORI_SECURITY_UNKNOWN)
{
#if GTK_CHECK_VERSION (2, 16, 0)
gchar* icon_names[] = { "channel-insecure-symbolic", "lock-insecure", "dialog-information", NULL };
gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY,
g_themed_icon_new_from_names (icon_names, -1));
#else
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_INFO);
#endif
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, _("Not verified"));
}
else if (hint == MIDORI_SECURITY_TRUSTED)
{
#if GTK_CHECK_VERSION (2, 16, 0)
gchar* icon_names[] = { "channel-secure-symbolic", "lock-secure", "locked", NULL };
gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY,
g_themed_icon_new_from_names (icon_names, -1));
#else
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_DIALOG_AUTHENTICATION);
#endif
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, _("Verified and encrypted connection"));
}
else if (hint == MIDORI_SECURITY_NONE)
{
#if GTK_CHECK_VERSION (2, 16, 0)
gtk_entry_set_icon_from_gicon (GTK_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY,
g_themed_icon_new_with_default_fallbacks ("text-html-symbolic"));
#else
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (entry), GTK_ICON_ENTRY_PRIMARY, STOCK_URL);
#endif
gtk_icon_entry_set_tooltip (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, _("Open, unencrypted connection"));
}

View File

@ -3038,10 +3038,8 @@ webkit_web_view_download_requested_cb (GtkWidget* web_view,
WebKitWebDataSource* datasource;
WebKitNetworkRequest* request;
GString* details;
#if GTK_CHECK_VERSION (2, 14, 0)
GIcon* icon;
GtkWidget* image;
#endif
gchar* title;
GdkScreen* screen;
GtkIconTheme* icon_theme;
@ -3064,14 +3062,12 @@ webkit_web_view_download_requested_cb (GtkWidget* web_view,
content_type = g_content_type_from_mime_type ("application/octet-stream");
mime_type = g_content_type_get_mime_type (content_type);
description = g_content_type_get_description (content_type);
#if GTK_CHECK_VERSION (2, 14, 0)
icon = g_content_type_get_icon (content_type);
g_themed_icon_append_name (G_THEMED_ICON (icon), "text-html");
image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG);
g_object_unref (icon);
gtk_widget_show (image);
gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), image);
#endif
g_free (content_type);
details = g_string_sized_new (20 * 4);

View File

@ -197,7 +197,6 @@ sokoke_show_uri_with_mime_type (GdkScreen* screen,
!g_str_has_prefix (uri, "file://"));
g_free (content_type);
files = g_list_prepend (NULL, file);
#if GTK_CHECK_VERSION (2, 14, 0)
#if GTK_CHECK_VERSION (3, 0, 0)
context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
#else
@ -205,9 +204,6 @@ sokoke_show_uri_with_mime_type (GdkScreen* screen,
#endif
gdk_app_launch_context_set_screen (context, screen);
gdk_app_launch_context_set_timestamp (context, timestamp);
#else
context = g_app_launch_context_new ();
#endif
success = g_app_info_launch (app_info, files, context, error);
@ -314,13 +310,8 @@ sokoke_show_uri (GdkScreen* screen,
sokoke_recursive_fork_protection (uri, TRUE);
#if GTK_CHECK_VERSION (2, 14, 0)
if (gtk_show_uri (screen, uri, timestamp, error))
return TRUE;
#else
if (g_app_info_launch_default_for_uri (uri, NULL, NULL))
return TRUE;
#endif
#if !GLIB_CHECK_VERSION (2, 28, 0)
info = sokoke_default_for_uri (uri, &scheme);

View File

@ -52,15 +52,10 @@ midori_findbar_set_icon (MidoriFindbar* findbar,
{
if (icon_name != NULL)
{
#if GTK_CHECK_VERSION (2, 16, 0)
gchar* symbolic_icon_name = g_strconcat (icon_name, "-symbolic", NULL);
gtk_entry_set_icon_from_gicon (GTK_ENTRY (findbar->find_text), icon_pos,
g_themed_icon_new_with_default_fallbacks (symbolic_icon_name));
g_free (symbolic_icon_name);
#else
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (findbar->find_text),
icon_pos, icon_name);
#endif
}
else
gtk_icon_entry_set_icon_from_icon_name (GTK_ICON_ENTRY (findbar->find_text),

View File

@ -259,7 +259,7 @@ def configure (conf):
check_pkg ('javascriptcoregtk-3.0', '1.5.1', args=args)
conf.env.append_value ('VALAFLAGS', '-D HAVE_GTK3')
else:
check_pkg ('gtk+-2.0', '2.10.0', var='GTK')
check_pkg ('gtk+-2.0', '2.16.0', var='GTK')
check_pkg ('webkit-1.0', '1.1.17', args=args)
if check_version (conf.check_cfg (modversion='webkit-1.0'), 1, 5, 1):
check_pkg ('javascriptcoregtk-1.0', '1.5.1', args=args)