summaryrefslogtreecommitdiff
path: root/katze
diff options
context:
space:
mode:
authorAndré Auzi <aauzi@free.fr>2014-04-25 19:38:16 +0200
committerAndré Auzi <aauzi@free.fr>2014-04-25 19:38:16 +0200
commit58b80411d76575c622d6880a859b195e1e4eaffe (patch)
treeed12b23bbb05ee95d821e0ff74f867933a472272 /katze
parentd5736c9e5c3afdf701f80004a35e96c3184013f7 (diff)
parent98a4ef5ae7d1d0e36f34cedf684903e924999dc3 (diff)
downloadmidori-58b80411d76575c622d6880a859b195e1e4eaffe.tar.gz
merge lp:midori
Diffstat (limited to 'katze')
-rw-r--r--katze/katze-array.c43
-rw-r--r--katze/katze-arrayaction.c204
-rw-r--r--katze/katze-item.c16
-rw-r--r--katze/katze-preferences.c24
-rw-r--r--katze/midori-paths.vala16
5 files changed, 194 insertions, 109 deletions
diff --git a/katze/katze-array.c b/katze/katze-array.c
index 380aa27a..b53cfb17 100644
--- a/katze/katze-array.c
+++ b/katze/katze-array.c
@@ -281,7 +281,7 @@ katze_array_finalize (GObject* object)
* The array will keep a reference on each object until
* it is removed from the array.
*
- * Return value: a new #KatzeArray
+ * Return value: (transfer full): a new #KatzeArray
**/
KatzeArray*
katze_array_new (GType type)
@@ -303,7 +303,7 @@ katze_array_new (GType type)
* Checks whether the array is compatible
* with items of the specified type.
*
- * Retur value: %TRUE if @array is compatible with @is_a_type
+ * Return value: %TRUE if @array is compatible with @is_a_type
**/
gboolean
katze_array_is_a (KatzeArray* array,
@@ -317,7 +317,7 @@ katze_array_is_a (KatzeArray* array,
/**
* katze_array_add_item:
* @array: a #KatzeArray
- * @item: an item
+ * @item: (type GObject) (transfer none): an item
*
* Adds an item to the array.
*
@@ -335,7 +335,7 @@ katze_array_add_item (KatzeArray* array,
/**
* katze_array_remove_item:
* @array: a #KatzeArray
- * @item: an item
+ * @item: (type GObject): an item
*
* Removes an item from the array.
*
@@ -357,7 +357,7 @@ katze_array_remove_item (KatzeArray* array,
*
* Retrieves the item in @array at the position @n.
*
- * Return value: an item, or %NULL
+ * Return value: (type GObject) (transfer none): an item, or %NULL
**/
gpointer
katze_array_get_nth_item (KatzeArray* array,
@@ -374,7 +374,7 @@ katze_array_get_nth_item (KatzeArray* array,
*
* Determines whether @array is empty.
*
- * Return value: an item, or %NULL
+ * Return value: %TRUE if the array is empty
**/
gboolean
katze_array_is_empty (KatzeArray* array)
@@ -387,11 +387,12 @@ katze_array_is_empty (KatzeArray* array)
/**
* katze_array_get_item_index:
* @array: a #KatzeArray
- * @item: an item in the array
+ * @item: (type GObject): an item in the array
*
* Retrieves the index of the item in @array.
*
- * Return value: an item, or -1
+ * Return value: the index of the item, or -1 if the item is not
+ * present in the array
**/
gint
katze_array_get_item_index (KatzeArray* array,
@@ -409,14 +410,14 @@ katze_array_get_item_index (KatzeArray* array,
*
* Looks up an item in the array which has the specified token.
*
- * This function will fail if the type of the list
- * is not based on #KatzeItem children.
+ * This function will fail and return NULL if the #KatzeArray's
+ * element type is not based on #KatzeItem.
*
* Note that @token is by definition unique to one item.
*
* Since 0.4.4 @token can be a "token keywords" string.
*
- * Return value: an item, or %NULL
+ * Return value: (type GObject) (transfer none): an item, or %NULL
**/
gpointer
katze_array_find_token (KatzeArray* array,
@@ -454,10 +455,10 @@ katze_array_find_token (KatzeArray* array,
*
* Looks up an item in the array which has the specified URI.
*
- * This function will fail if the type of the list
- * is not based on #KatzeItem children.
+ * This function will fail and return NULL if the #KatzeArray's
+ * element type is not based on #KatzeItem.
*
- * Return value: an item, or %NULL
+ * Return value: (type GObject) (transfer none): an item, or %NULL
*
* Since: 0.2.0
**/
@@ -486,7 +487,7 @@ katze_array_find_uri (KatzeArray* array,
*
* Retrieves the number of items in @array.
*
- * Return value: the length of the list
+ * Return value: the length of the #KatzeArray
**/
guint
katze_array_get_length (KatzeArray* array)
@@ -499,7 +500,7 @@ katze_array_get_length (KatzeArray* array)
/**
* katze_array_move_item:
* @array: a #KatzeArray
- * @item: the item being moved
+ * @item: (type GObject): the item being moved
* @position: the new position of the item
*
* Moves @item to the position @position.
@@ -522,7 +523,7 @@ katze_array_move_item (KatzeArray* array,
*
* Retrieves the items as a list.
*
- * Return value: a newly allocated #GList of items
+ * Return value: (element-type GObject) (transfer container): a newly allocated #GList of items
*
* Since: 0.2.5
**/
@@ -534,6 +535,14 @@ katze_array_get_items (KatzeArray* array)
return g_list_copy (array->priv->items);
}
+/**
+ * katze_array_peek_items:
+ * @array: a #KatzeArray
+ *
+ * Peeks at the KatzeArray's internal list of items.
+ *
+ * Return value: (element-type GObject) (transfer none): the #KatzeArray's internal #GList of items
+ **/
GList*
katze_array_peek_items (KatzeArray* array)
{
diff --git a/katze/katze-arrayaction.c b/katze/katze-arrayaction.c
index dc8a9026..bf6fcb51 100644
--- a/katze/katze-arrayaction.c
+++ b/katze/katze-arrayaction.c
@@ -159,15 +159,14 @@ katze_array_action_class_init (KatzeArrayActionClass* class)
/**
* KatzeArrayAction::activate-item-alt:
* @array: the object on which the signal is emitted
+ * @proxy: the %GtkWidget that caught the event
* @item: the item being activated
- * @button: the mouse button pressed
+ * @event: the mouse button pressed event
*
* 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.
- *
- * Since: 0.1.7
**/
signals[ACTIVATE_ITEM_ALT] = g_signal_new ("activate-item-alt",
G_TYPE_FROM_CLASS (class),
@@ -175,9 +174,9 @@ katze_array_action_class_init (KatzeArrayActionClass* class)
0,
0,
NULL,
- midori_cclosure_marshal_BOOLEAN__OBJECT_UINT,
- G_TYPE_BOOLEAN, 2,
- KATZE_TYPE_ITEM, G_TYPE_UINT);
+ midori_cclosure_marshal_BOOLEAN__OBJECT_OBJECT_POINTER,
+ G_TYPE_BOOLEAN, 3,
+ KATZE_TYPE_ITEM, GTK_TYPE_WIDGET, G_TYPE_POINTER);
gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = katze_array_action_finalize;
@@ -287,14 +286,33 @@ katze_array_action_activate (GtkAction* action)
static void
katze_array_action_activate_item (KatzeArrayAction* action,
- KatzeItem* item,
- gint button)
+ KatzeItem* item)
+{
+ g_signal_emit (action, signals[ACTIVATE_ITEM], 0, item);
+}
+
+static gboolean
+katze_array_action_activate_item_alt (KatzeArrayAction* action,
+ KatzeItem* item,
+ GdkEventButton* event,
+ GtkWidget* proxy)
{
+ /* katze_array_action_activate_item emits the signal.
+ * It can result from "clicked" event where the button event
+ * is not provided.
+ */
+
gboolean handled = FALSE;
+
+ g_assert (event);
+
g_signal_emit (action, signals[ACTIVATE_ITEM_ALT], 0, item,
- button, &handled);
+ proxy, event, &handled);
+
if (!handled)
- g_signal_emit (action, signals[ACTIVATE_ITEM], 0, item);
+ katze_array_action_activate_item (action, item);
+
+ return handled;
}
static void
@@ -302,7 +320,18 @@ katze_array_action_menu_activate_cb (GtkWidget* proxy,
KatzeArrayAction* array_action)
{
KatzeItem* item = g_object_get_data (G_OBJECT (proxy), "KatzeItem");
- katze_array_action_activate_item (array_action, item, 1);
+
+ katze_array_action_activate_item (array_action, item);
+}
+
+static gboolean
+katze_array_action_menu_item_button_press_cb (GtkWidget* proxy,
+ GdkEventButton* event,
+ KatzeArrayAction* array_action)
+{
+ KatzeItem* item = g_object_get_data (G_OBJECT (proxy), "KatzeItem");
+
+ return katze_array_action_activate_item_alt (array_action, item, event, proxy);
}
static gboolean
@@ -310,22 +339,70 @@ katze_array_action_menu_button_press_cb (GtkWidget* proxy,
GdkEventButton* event,
KatzeArrayAction* array_action)
{
- KatzeItem* item = g_object_get_data (G_OBJECT (proxy), "KatzeItem");
+ /* Take precedence over menu button-press-event handling to avoid
+ menu item activation and menu disparition for popup opening
+ */
- katze_array_action_activate_item (array_action, item, event->button);
+ return katze_array_action_menu_item_button_press_cb (gtk_get_event_widget ((GdkEvent *) event), event, array_action);
+}
- /* we need to block the 'activate' handler which would be called
- * otherwise as well */
- g_signal_handlers_block_by_func (proxy,
- katze_array_action_menu_activate_cb, array_action);
+static gboolean
+katze_array_action_tool_item_child_button_press_cb (GtkWidget* proxy,
+ GdkEventButton* event,
+ KatzeArrayAction* array_action)
+{
+ GtkWidget* toolitem = gtk_widget_get_parent (proxy);
+ KatzeItem* item = g_object_get_data (G_OBJECT (toolitem), "KatzeItem");
- return TRUE;
+ /* let the 'clicked' signal be processed normally */
+ if (event->button == 1)
+ return FALSE;
+
+ return katze_array_action_activate_item_alt (array_action, item, event, proxy);
}
static void
katze_array_action_menu_item_select_cb (GtkWidget* proxy,
KatzeArrayAction* array_action);
+static GtkWidget*
+katze_array_action_menu_item_new (KatzeArrayAction* array_action,
+ KatzeItem* item)
+{
+ GtkWidget* menuitem = katze_image_menu_item_new_ellipsized (
+ katze_item_get_name (item));
+ GtkWidget* image = katze_item_get_image (item, menuitem);
+
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
+ gtk_image_menu_item_set_always_show_image (
+ GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
+
+ g_object_set_data (G_OBJECT (menuitem), "KatzeItem", item);
+
+ if (KATZE_ITEM_IS_FOLDER (item))
+ {
+ GtkWidget* submenu = gtk_menu_new ();
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
+ g_signal_connect (submenu, "button-press-event",
+ G_CALLBACK (katze_array_action_menu_button_press_cb), array_action);
+ g_signal_connect (menuitem, "select",
+ G_CALLBACK (katze_array_action_menu_item_select_cb), array_action);
+ g_signal_connect (menuitem, "activate",
+ G_CALLBACK (katze_array_action_menu_item_select_cb), array_action);
+ }
+ else
+ {
+ /* we need the 'activate' signal as well for keyboard events */
+ g_signal_connect (menuitem, "activate",
+ G_CALLBACK (katze_array_action_menu_activate_cb), array_action);
+ }
+
+ g_signal_connect (menuitem, "button-press-event",
+ G_CALLBACK (katze_array_action_menu_item_button_press_cb), array_action);
+
+ return menuitem;
+}
+
/**
* katze_array_action_generate_menu:
* @array_action: a #KatzeArrayAction
@@ -355,15 +432,13 @@ katze_array_action_generate_menu (KatzeArrayAction* array_action,
gint summand;
KatzeItem* item;
GtkWidget* menuitem;
- GtkWidget* image;
- GtkWidget* submenu;
g_return_if_fail (KATZE_IS_ARRAY_ACTION (array_action));
g_return_if_fail (KATZE_IS_ITEM (array));
g_return_if_fail (GTK_IS_MENU_SHELL (menu));
g_return_if_fail (GTK_IS_TOOL_ITEM (proxy)
- || GTK_IS_MENU_ITEM (proxy)
- || GTK_IS_WINDOW (proxy));
+ || GTK_IS_MENU_ITEM (proxy)
+ || GTK_IS_WINDOW (proxy));
if (!KATZE_IS_ARRAY (array))
return;
@@ -388,35 +463,19 @@ katze_array_action_generate_menu (KatzeArrayAction* array_action,
gtk_menu_shell_append (menu, menuitem);
continue;
}
- menuitem = katze_image_menu_item_new_ellipsized (
- katze_item_get_name (item));
- image = katze_item_get_image (item, menuitem);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
- gtk_image_menu_item_set_always_show_image (
- GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
- gtk_menu_shell_append (menu, menuitem);
- g_object_set_data (G_OBJECT (menuitem), "KatzeItem", item);
+
+ menuitem = katze_array_action_menu_item_new (array_action, item);
+
if (KATZE_ITEM_IS_FOLDER (item))
{
- submenu = gtk_menu_new ();
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
+ GtkWidget* submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menuitem));
/* Make sure menu appears to contain items */
gtk_menu_shell_append (GTK_MENU_SHELL (submenu),
gtk_separator_menu_item_new ());
- g_signal_connect (menuitem, "select",
- G_CALLBACK (katze_array_action_menu_item_select_cb), array_action);
- g_signal_connect (menuitem, "activate",
- G_CALLBACK (katze_array_action_menu_item_select_cb), array_action);
- }
- else
- {
- /* we need the 'activate' signal as well for keyboard events */
- g_signal_connect (menuitem, "activate",
- G_CALLBACK (katze_array_action_menu_activate_cb), array_action);
}
- g_signal_connect (menuitem, "button-press-event",
- G_CALLBACK (katze_array_action_menu_button_press_cb), array_action);
+
gtk_widget_show (menuitem);
+ gtk_menu_shell_append (menu, menuitem);
}
}
@@ -444,7 +503,7 @@ katze_array_action_menu_item_need_update (KatzeArrayAction* array_action,
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);
g_object_set_data (G_OBJECT (proxy), "last-update",
- GINT_TO_POINTER (time (NULL)));
+ GINT_TO_POINTER (time (NULL)));
return TRUE;
}
@@ -476,13 +535,14 @@ katze_array_action_proxy_clicked_cb (GtkWidget* proxy,
gboolean handled = FALSE;
array = (KatzeArray*)g_object_get_data (G_OBJECT (proxy), "KatzeItem");
+
if (GTK_IS_MENU_ITEM (proxy))
{
if (katze_array_action_menu_item_need_update (array_action, proxy))
{
g_signal_emit (array_action, signals[POPULATE_FOLDER], 0,
- gtk_menu_item_get_submenu (GTK_MENU_ITEM (proxy)),
- array, &handled);
+ gtk_menu_item_get_submenu (GTK_MENU_ITEM (proxy)),
+ array, &handled);
if (!handled)
g_signal_emit (array_action, signals[POPULATE_POPUP], 0,
gtk_menu_item_get_submenu (GTK_MENU_ITEM (proxy)));
@@ -492,7 +552,7 @@ katze_array_action_proxy_clicked_cb (GtkWidget* proxy,
if (KATZE_IS_ITEM (array) && katze_item_get_uri ((KatzeItem*)array))
{
- katze_array_action_activate_item (array_action, KATZE_ITEM (array), 1);
+ katze_array_action_activate_item (array_action, KATZE_ITEM (array));
return;
}
@@ -512,7 +572,7 @@ katze_array_action_proxy_clicked_cb (GtkWidget* proxy,
}
katze_widget_popup (GTK_WIDGET (proxy), GTK_MENU (menu),
- NULL, KATZE_MENU_POSITION_LEFT);
+ NULL, KATZE_MENU_POSITION_LEFT);
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), TRUE);
g_object_set_data (G_OBJECT (menu), "KatzeArrayAction", array_action);
g_signal_connect (menu, "deactivate",
@@ -606,31 +666,9 @@ katze_array_action_proxy_create_menu_proxy_cb (GtkWidget* proxy,
{
KatzeArrayAction* array_action;
GtkWidget* menuitem;
- GtkWidget* image;
array_action = g_object_get_data (G_OBJECT (proxy), "KatzeArrayAction");
- menuitem = katze_image_menu_item_new_ellipsized (
- katze_item_get_name (item));
- image = katze_item_get_image (item, menuitem);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
- gtk_image_menu_item_set_always_show_image (
- GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
- g_object_set_data (G_OBJECT (menuitem), "KatzeItem", item);
- if (KATZE_ITEM_IS_FOLDER (item))
- {
- GtkWidget* submenu = gtk_menu_new ();
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
- g_signal_connect (menuitem, "select",
- G_CALLBACK (katze_array_action_menu_item_select_cb), array_action);
- }
- else
- {
- g_signal_connect (menuitem, "button-press-event",
- G_CALLBACK (katze_array_action_menu_button_press_cb), array_action);
- /* we need the 'activate' signal as well for keyboard events */
- g_signal_connect (menuitem, "activate",
- G_CALLBACK (katze_array_action_menu_activate_cb), array_action);
- }
+ menuitem = katze_array_action_menu_item_new (array_action, item);
gtk_tool_item_set_proxy_menu_item (GTK_TOOL_ITEM (proxy),
"katze-tool-item-menu", menuitem);
return TRUE;
@@ -706,9 +744,19 @@ katze_array_action_create_tool_item_for (KatzeArrayAction* array_action,
else
gtk_tool_item_set_tooltip_text (toolitem, uri);
- g_object_set_data (G_OBJECT (toolitem), "KatzeArray", item);
+ g_object_set_data (G_OBJECT (toolitem), "KatzeItem", item);
g_signal_connect (toolitem, "clicked",
G_CALLBACK (katze_array_action_proxy_clicked_cb), array_action);
+ if (KATZE_IS_ITEM (item))
+ {
+ /* Tool items block the "button-press-event" but we can get it
+ * when connecting it to the tool item's child widget
+ */
+
+ GtkWidget* child = gtk_bin_get_child (GTK_BIN (toolitem));
+ g_signal_connect (child, "button-press-event",
+ G_CALLBACK (katze_array_action_tool_item_child_button_press_cb), array_action);
+ }
g_object_set_data (G_OBJECT (toolitem), "KatzeArrayAction", array_action);
g_signal_connect (item, "notify",
@@ -781,11 +829,11 @@ katze_array_action_set_array (KatzeArrayAction* array_action,
/* FIXME: Add and remove items dynamically */
/*g_object_connect (array,
- "signal-after::add-item",
- katze_array_action_engines_add_item_cb, array_action,
- "signal-after::remove-item",
- katze_array_action_engines_remove_item_cb, array_action,
- NULL);*/
+ "signal-after::add-item",
+ katze_array_action_engines_add_item_cb, array_action,
+ "signal-after::remove-item",
+ katze_array_action_engines_remove_item_cb, array_action,
+ NULL);*/
g_object_notify (G_OBJECT (array_action), "array");
diff --git a/katze/katze-item.c b/katze/katze-item.c
index 0f06e36e..5746b4de 100644
--- a/katze/katze-item.c
+++ b/katze/katze-item.c
@@ -342,7 +342,7 @@ katze_item_get_text (KatzeItem* item)
/**
* katze_item_set_text:
* @item: a #KatzeItem
- * @description: a string
+ * @text: a string
*
* Sets the descriptive text of @item.
**/
@@ -435,9 +435,9 @@ katze_item_set_icon (KatzeItem* item,
* @item: a #KatzeItem
* @widget: a #GtkWidget, or %NULL
*
- * Retrieves a #GdkPixbuf fit to display @item.
+ * Creates a #GdkPixbuf fit to display @item.
*
- * Return value: the icon of the item
+ * Return value: (transfer full): the icon of the item, or %NULL
*
* Since: 0.4.6
**/
@@ -495,12 +495,12 @@ katze_item_image_destroyed_cb (GtkWidget* image,
* @item: a #KatzeItem
* @widget: a #GtkWidget, or %NULL
*
- * Retrieves a #GtkImage fit to display @item.
+ * Creates a #GtkImage fit to display @item.
*
- * Return value: the icon of the item
+ * Return value: (transfer floating): the icon of the item
*
* Since: 0.4.4
- * Since 0.4.8 a @widget was added and the image is visible.
+ * Since 0.4.8 a @widget was added and the image is set visible.
**/
GtkWidget*
katze_item_get_image (KatzeItem* item,
@@ -600,7 +600,7 @@ katze_item_set_added (KatzeItem* item,
*
* Retrieves a list of all meta keys.
*
- * Return value: a newly allocated #GList of constant strings
+ * Return value: (element-type utf8) (transfer container): a newly allocated #GList of constant strings
*
* Since: 0.1.8
**/
@@ -778,7 +778,7 @@ katze_item_set_meta_integer (KatzeItem* item,
*
* Since 0.1.2 you can monitor the "parent" property.
*
- * Return value: the parent of the item
+ * Return value: (type GObject) (transfer none): the parent of the item
**/
gpointer
katze_item_get_parent (KatzeItem* item)
diff --git a/katze/katze-preferences.c b/katze/katze-preferences.c
index ca28e7b5..f008fbf7 100644
--- a/katze/katze-preferences.c
+++ b/katze/katze-preferences.c
@@ -143,8 +143,12 @@ static void
katze_preferences_prepare (KatzePreferences* preferences)
{
KatzePreferencesPrivate* priv = preferences->priv;
-
+
+ #if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX
+ priv->notebook = gtk_stack_new ();
+ #else
priv->notebook = gtk_notebook_new ();
+ #endif
gtk_container_set_border_width (GTK_CONTAINER (priv->notebook), 6);
#if HAVE_OSX
@@ -156,7 +160,16 @@ katze_preferences_prepare (KatzePreferences* preferences)
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),
priv->toolbar, FALSE, FALSE, 0);
#else
- priv->toolbar = NULL;
+ #if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX
+ priv->toolbar = gtk_stack_switcher_new ();
+ gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (priv->toolbar), GTK_STACK (priv->notebook));
+ gtk_widget_set_halign (priv->toolbar, GTK_ALIGN_CENTER);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),
+ priv->toolbar, FALSE, FALSE, 0);
+ #else
+ priv->toolbar = NULL;
+ #endif
+
#endif
priv->toolbutton = NULL;
gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (preferences))),
@@ -219,8 +232,15 @@ katze_preferences_add_category (KatzePreferences* preferences,
priv->sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_widget_show (priv->page);
gtk_container_set_border_width (GTK_CONTAINER (priv->page), 4);
+ #if GTK_CHECK_VERSION (3, 10, 0) & !HAVE_OSX
+ gtk_stack_add_titled (GTK_STACK (priv->notebook),
+ priv->page, label, label);
+ #else
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
priv->page, gtk_label_new (label));
+
+ #endif
+
#if HAVE_OSX
priv->toolbutton = GTK_WIDGET (priv->toolbutton ?
gtk_radio_tool_button_new_from_widget (
diff --git a/katze/midori-paths.vala b/katze/midori-paths.vala
index ee65e78a..3ef5d116 100644
--- a/katze/midori-paths.vala
+++ b/katze/midori-paths.vala
@@ -366,17 +366,24 @@ namespace Midori {
if (Posix.access (path, Posix.F_OK) == 0)
return path;
+ return build_folder ("data", null, filename) ??
+ Path.build_filename (MDATADIR, PACKAGE_NAME, "res", filename);
+ #endif
+ }
+
+ string? build_folder (string folder, string? middle, string filename) {
/* Fallback to build folder */
File? parent = File.new_for_path (exec_path);
while (parent != null) {
- var data = parent.get_child ("data");
+ var data = parent.get_child (folder);
+ if (middle != null)
+ data = data.get_child (middle);
var child = data.get_child (filename);
if (child.query_exists ())
return child.get_path ();
parent = parent.get_parent ();
}
- return Path.build_filename (MDATADIR, PACKAGE_NAME, "res", filename);
- #endif
+ return null;
}
/* returns the path to a file containing read-only data installed with the application
@@ -416,7 +423,8 @@ namespace Midori {
return path;
}
- return Path.build_filename (SYSCONFDIR, "xdg", PACKAGE_NAME, folder ?? "", filename);
+ return build_folder ("config", folder, filename) ??
+ Path.build_filename (SYSCONFDIR, "xdg", PACKAGE_NAME, folder ?? "", filename);
#endif
}