1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
/*
Copyright (C) 2007-2008 Christian Dywan <christian@twotoasts.de>
Copyright (C) 2009 Dale Whittaker <dayul@users.sf.net>
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__
#include <gtk/gtk.h>
#include "katze-array.h"
#include "gtk3-compat.h"
G_BEGIN_DECLS
/**
* katze_assign:
* @lvalue: a pointer
* @rvalue: the new value
*
* Frees @lvalue if needed and assigns it the value of @rvalue.
**/
#define katze_assign(lvalue, rvalue) lvalue = (g_free (lvalue), rvalue)
/**
* 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) \
lvalue = ((lvalue ? g_object_unref (lvalue) : (void)0), rvalue)
/**
* 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
**/
#define katze_strv_assign(lvalue, rvalue) lvalue = (g_strfreev (lvalue), rvalue)
/**
* 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 : "";
}
GtkWidget*
katze_property_proxy (gpointer object,
const gchar* property,
const gchar* hint);
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);
gboolean
katze_tree_view_get_selected_iter (GtkTreeView* treeview,
GtkTreeModel** model,
GtkTreeIter* iter);
void
katze_bookmark_populate_tree_view (KatzeArray* array,
GtkTreeStore* model,
GtkTreeIter* parent);
gchar*
katze_strip_mnemonics (const gchar* original);
const gchar*
katze_skip_whitespace (const gchar* str);
gint
katze_object_get_boolean (gpointer object,
const gchar* property);
gint
katze_object_get_int (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);
gpointer
katze_object_get_object (gpointer object,
const gchar* property);
int
katze_mkdir_with_parents (const gchar* pathname,
int mode);
GtkWidget*
katze_uri_entry_new (GtkWidget* other_widget);
void
katze_widget_add_class (GtkWidget* widget,
const gchar* class_name);
void
katze_assert_str_equal (const gchar* input,
const gchar* result,
const gchar* expected);
void
katze_window_set_sensible_default_size (GtkWindow* window);
G_END_DECLS
#endif /* __KATZE_UTILS_H__ */
|