2008-01-05 06:24:38 +01:00
|
|
|
/*
|
2008-04-13 21:21:39 +02:00
|
|
|
Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
|
2009-04-25 16:01:28 +02:00
|
|
|
Copyright (C) 2009 Dale Whittaker <dayul@users.sf.net>
|
2008-01-05 06:24:38 +01:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
See the file COPYING for the full license text.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __KATZE_UTILS_H__
|
|
|
|
#define __KATZE_UTILS_H__
|
|
|
|
|
2008-04-13 21:21:39 +02:00
|
|
|
#include <gtk/gtk.h>
|
2010-07-01 11:43:57 -04:00
|
|
|
#include "katze-array.h"
|
2011-11-28 23:37:34 +01:00
|
|
|
#include "gtk3-compat.h"
|
2008-01-05 06:24:38 +01:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2008-04-28 22:38:57 +02:00
|
|
|
/**
|
|
|
|
* KATZE_OBJECT_NAME:
|
|
|
|
* @object: an object
|
|
|
|
*
|
|
|
|
* Return the name of an object's class structure's type.
|
|
|
|
**/
|
|
|
|
#define KATZE_OBJECT_NAME(object) \
|
|
|
|
G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (object))
|
|
|
|
|
2008-01-05 06:24:38 +01:00
|
|
|
/**
|
|
|
|
* katze_assign:
|
|
|
|
* @lvalue: a pointer
|
|
|
|
* @rvalue: the new value
|
|
|
|
*
|
|
|
|
* Frees @lvalue if needed and assigns it the value of @rvalue.
|
|
|
|
**/
|
2010-09-18 01:45:17 +02:00
|
|
|
#define katze_assign(lvalue, rvalue) lvalue = (g_free (lvalue), rvalue)
|
2008-01-05 06:24:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* katze_object_assign:
|
|
|
|
* @lvalue: a gobject
|
|
|
|
* @rvalue: the new value
|
|
|
|
*
|
|
|
|
* Unrefs @lvalue if needed and assigns it the value of @rvalue.
|
|
|
|
**/
|
|
|
|
#define katze_object_assign(lvalue, rvalue) \
|
2010-09-18 01:45:17 +02:00
|
|
|
lvalue = ((lvalue ? g_object_unref (lvalue) : lvalue), rvalue)
|
2008-01-05 06:24:38 +01:00
|
|
|
|
2009-04-25 16:01:28 +02:00
|
|
|
/**
|
|
|
|
* katze_strv_assign:
|
|
|
|
* @lvalue: a string list
|
|
|
|
* @rvalue: the new value
|
|
|
|
*
|
|
|
|
* Frees @lvalue if needed and assigns it the value of @rvalue.
|
|
|
|
*
|
|
|
|
* Since: 0.1.7
|
|
|
|
**/
|
2010-09-18 01:45:17 +02:00
|
|
|
#define katze_strv_assign(lvalue, rvalue) lvalue = (g_strfreev (lvalue), rvalue)
|
2009-04-25 16:01:28 +02:00
|
|
|
|
2012-02-19 17:44:15 +01:00
|
|
|
/**
|
|
|
|
* katze_str_non_null:
|
|
|
|
* @str: a string, or %NULL
|
|
|
|
*
|
|
|
|
* Returns "" if @str is %NULL.
|
|
|
|
*
|
|
|
|
* Since: 0.4.4
|
|
|
|
**/
|
|
|
|
static inline const gchar*
|
|
|
|
katze_str_non_null (const gchar* str)
|
|
|
|
{
|
|
|
|
return str ? str : "";
|
|
|
|
}
|
|
|
|
|
2008-04-13 21:21:39 +02:00
|
|
|
GtkWidget*
|
|
|
|
katze_property_proxy (gpointer object,
|
|
|
|
const gchar* property,
|
|
|
|
const gchar* hint);
|
|
|
|
|
|
|
|
GtkWidget*
|
|
|
|
katze_property_label (gpointer object,
|
|
|
|
const gchar* property);
|
|
|
|
|
2008-10-10 22:31:37 +02:00
|
|
|
typedef enum {
|
|
|
|
KATZE_MENU_POSITION_CURSOR = 0,
|
|
|
|
KATZE_MENU_POSITION_LEFT,
|
|
|
|
KATZE_MENU_POSITION_RIGHT
|
|
|
|
} KatzeMenuPos;
|
|
|
|
|
|
|
|
void
|
|
|
|
katze_widget_popup (GtkWidget* widget,
|
|
|
|
GtkMenu* menu,
|
|
|
|
GdkEventButton* event,
|
|
|
|
KatzeMenuPos pos);
|
|
|
|
|
|
|
|
GtkWidget*
|
|
|
|
katze_image_menu_item_new_ellipsized (const gchar* label);
|
|
|
|
|
2008-10-24 00:09:12 +02:00
|
|
|
GdkPixbuf*
|
|
|
|
katze_pixbuf_new_from_buffer (const guchar* buffer,
|
|
|
|
gsize length,
|
|
|
|
const gchar* mime_type,
|
|
|
|
GError** error);
|
|
|
|
|
2009-01-28 01:08:51 +01:00
|
|
|
gboolean
|
2010-07-01 11:43:57 -04:00
|
|
|
katze_tree_view_get_selected_iter (GtkTreeView* treeview,
|
|
|
|
GtkTreeModel** model,
|
|
|
|
GtkTreeIter* iter);
|
|
|
|
|
|
|
|
void
|
|
|
|
katze_bookmark_populate_tree_view (KatzeArray* array,
|
|
|
|
GtkTreeStore* model,
|
|
|
|
GtkTreeIter* parent);
|
2009-01-28 01:08:51 +01:00
|
|
|
|
2009-07-17 21:29:57 +02:00
|
|
|
gchar*
|
|
|
|
katze_strip_mnemonics (const gchar* original);
|
|
|
|
|
2012-02-10 23:01:50 +01:00
|
|
|
const gchar*
|
|
|
|
katze_skip_whitespace (const gchar* str);
|
|
|
|
|
2008-12-01 23:33:47 +01:00
|
|
|
gboolean
|
|
|
|
katze_object_has_property (gpointer object,
|
|
|
|
const gchar* property);
|
|
|
|
|
2008-11-18 22:59:19 +01:00
|
|
|
gint
|
|
|
|
katze_object_get_boolean (gpointer object,
|
|
|
|
const gchar* property);
|
|
|
|
|
|
|
|
gint
|
|
|
|
katze_object_get_int (gpointer object,
|
|
|
|
const gchar* property);
|
|
|
|
|
|
|
|
gfloat
|
|
|
|
katze_object_get_float (gpointer object,
|
|
|
|
const gchar* property);
|
|
|
|
|
|
|
|
gint
|
|
|
|
katze_object_get_enum (gpointer object,
|
|
|
|
const gchar* property);
|
|
|
|
|
|
|
|
gchar*
|
|
|
|
katze_object_get_string (gpointer object,
|
|
|
|
const gchar* property);
|
|
|
|
|
2008-11-18 01:57:33 +01:00
|
|
|
gpointer
|
|
|
|
katze_object_get_object (gpointer object,
|
|
|
|
const gchar* property);
|
|
|
|
|
2009-10-20 18:24:24 +02:00
|
|
|
int
|
|
|
|
katze_mkdir_with_parents (const gchar* pathname,
|
|
|
|
int mode);
|
|
|
|
|
2009-10-28 20:38:09 +01:00
|
|
|
gboolean
|
|
|
|
katze_widget_has_touchscreen_mode (GtkWidget* widget);
|
|
|
|
|
2009-11-17 23:22:08 +01:00
|
|
|
GdkPixbuf*
|
|
|
|
katze_load_cached_icon (const gchar* uri,
|
|
|
|
GtkWidget* widget);
|
|
|
|
|
2011-05-15 16:45:14 +02:00
|
|
|
GtkWidget*
|
|
|
|
katze_uri_entry_new (GtkWidget* other_widget);
|
|
|
|
|
2012-07-28 11:06:40 +02:00
|
|
|
void
|
|
|
|
katze_widget_add_class (GtkWidget* widget,
|
|
|
|
const gchar* class_name);
|
|
|
|
|
2011-11-18 00:52:10 +01:00
|
|
|
void
|
|
|
|
katze_assert_str_equal (const gchar* input,
|
|
|
|
const gchar* result,
|
|
|
|
const gchar* expected);
|
|
|
|
|
2008-01-05 06:24:38 +01:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __KATZE_UTILS_H__ */
|