Bug Summary

File:plugins/taglist/lapiz-taglist-plugin-panel.c
Warning:line 193, column 3
Value stored to 'sel' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name lapiz-taglist-plugin-panel.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/plugins/taglist -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I ../.. -I ../.. -I /usr/include/libxml2 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/local/include/ctksourceview-4 -I /usr/local/include/libbean-1.0 -I /usr/include/gobject-introspection-1.0 -D PIC -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/plugins/taglist -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-08-12-122103-33952-1 -x c lapiz-taglist-plugin-panel.c
1/*
2 * lapiz-taglist-plugin-panel.c
3 * This file is part of lapiz
4 *
5 * Copyright (C) 2005 - Paolo Maggi
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 */
22
23/*
24 * Modified by the lapiz Team, 2005. See the AUTHORS file for a
25 * list of people on the lapiz Team.
26 * See the ChangeLog files for a list of changes.
27 *
28 * $Id$
29 */
30
31#ifdef HAVE_CONFIG_H1
32#include <config.h>
33#endif
34
35#include <string.h>
36
37#include "lapiz-taglist-plugin-panel.h"
38#include "lapiz-taglist-plugin-parser.h"
39
40#include <lapiz/lapiz-utils.h>
41#include <lapiz/lapiz-debug.h>
42
43#include <ctk/ctk.h>
44#include <cdk/cdkkeysyms.h>
45#include <glib/gi18n.h>
46
47enum
48{
49 COLUMN_TAG_NAME,
50 COLUMN_TAG_INDEX_IN_GROUP,
51 NUM_COLUMNS
52};
53
54struct _LapizTaglistPluginPanelPrivate
55{
56 LapizWindow *window;
57
58 CtkWidget *tag_groups_combo;
59 CtkWidget *tags_list;
60 CtkWidget *preview;
61
62 TagGroup *selected_tag_group;
63
64 gchar *data_dir;
65};
66
67G_DEFINE_DYNAMIC_TYPE_EXTENDED (LapizTaglistPluginPanel,static void lapiz_taglist_plugin_panel_init (LapizTaglistPluginPanel
*self); static void lapiz_taglist_plugin_panel_class_init (LapizTaglistPluginPanelClass
*klass); static void lapiz_taglist_plugin_panel_class_finalize
(LapizTaglistPluginPanelClass *klass); static gpointer lapiz_taglist_plugin_panel_parent_class
= ((void*)0); static GType lapiz_taglist_plugin_panel_type_id
= 0; static gint LapizTaglistPluginPanel_private_offset; static
void lapiz_taglist_plugin_panel_class_intern_init (gpointer klass
) { lapiz_taglist_plugin_panel_parent_class = g_type_class_peek_parent
(klass); if (LapizTaglistPluginPanel_private_offset != 0) g_type_class_adjust_private_offset
(klass, &LapizTaglistPluginPanel_private_offset); lapiz_taglist_plugin_panel_class_init
((LapizTaglistPluginPanelClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer lapiz_taglist_plugin_panel_get_instance_private
(LapizTaglistPluginPanel *self) { return (((gpointer) ((guint8
*) (self) + (glong) (LapizTaglistPluginPanel_private_offset))
)); } GType lapiz_taglist_plugin_panel_get_type (void) { return
lapiz_taglist_plugin_panel_type_id; } static void lapiz_taglist_plugin_panel_register_type
(GTypeModule *type_module) { GType g_define_type_id __attribute__
((__unused__)); const GTypeInfo g_define_type_info = { sizeof
(LapizTaglistPluginPanelClass), (GBaseInitFunc) ((void*)0), (
GBaseFinalizeFunc) ((void*)0), (GClassInitFunc)(void (*)(void
)) lapiz_taglist_plugin_panel_class_intern_init, (GClassFinalizeFunc
)(void (*)(void)) lapiz_taglist_plugin_panel_class_finalize, (
(void*)0), sizeof (LapizTaglistPluginPanel), 0, (GInstanceInitFunc
)(void (*)(void)) lapiz_taglist_plugin_panel_init, ((void*)0)
}; lapiz_taglist_plugin_panel_type_id = g_type_module_register_type
(type_module, (ctk_box_get_type ()), "LapizTaglistPluginPanel"
, &g_define_type_info, (GTypeFlags) 0); g_define_type_id =
lapiz_taglist_plugin_panel_type_id; { { LapizTaglistPluginPanel_private_offset
= sizeof (LapizTaglistPluginPanelPrivate); } ; } }
68 lapiz_taglist_plugin_panel,static void lapiz_taglist_plugin_panel_init (LapizTaglistPluginPanel
*self); static void lapiz_taglist_plugin_panel_class_init (LapizTaglistPluginPanelClass
*klass); static void lapiz_taglist_plugin_panel_class_finalize
(LapizTaglistPluginPanelClass *klass); static gpointer lapiz_taglist_plugin_panel_parent_class
= ((void*)0); static GType lapiz_taglist_plugin_panel_type_id
= 0; static gint LapizTaglistPluginPanel_private_offset; static
void lapiz_taglist_plugin_panel_class_intern_init (gpointer klass
) { lapiz_taglist_plugin_panel_parent_class = g_type_class_peek_parent
(klass); if (LapizTaglistPluginPanel_private_offset != 0) g_type_class_adjust_private_offset
(klass, &LapizTaglistPluginPanel_private_offset); lapiz_taglist_plugin_panel_class_init
((LapizTaglistPluginPanelClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer lapiz_taglist_plugin_panel_get_instance_private
(LapizTaglistPluginPanel *self) { return (((gpointer) ((guint8
*) (self) + (glong) (LapizTaglistPluginPanel_private_offset))
)); } GType lapiz_taglist_plugin_panel_get_type (void) { return
lapiz_taglist_plugin_panel_type_id; } static void lapiz_taglist_plugin_panel_register_type
(GTypeModule *type_module) { GType g_define_type_id __attribute__
((__unused__)); const GTypeInfo g_define_type_info = { sizeof
(LapizTaglistPluginPanelClass), (GBaseInitFunc) ((void*)0), (
GBaseFinalizeFunc) ((void*)0), (GClassInitFunc)(void (*)(void
)) lapiz_taglist_plugin_panel_class_intern_init, (GClassFinalizeFunc
)(void (*)(void)) lapiz_taglist_plugin_panel_class_finalize, (
(void*)0), sizeof (LapizTaglistPluginPanel), 0, (GInstanceInitFunc
)(void (*)(void)) lapiz_taglist_plugin_panel_init, ((void*)0)
}; lapiz_taglist_plugin_panel_type_id = g_type_module_register_type
(type_module, (ctk_box_get_type ()), "LapizTaglistPluginPanel"
, &g_define_type_info, (GTypeFlags) 0); g_define_type_id =
lapiz_taglist_plugin_panel_type_id; { { LapizTaglistPluginPanel_private_offset
= sizeof (LapizTaglistPluginPanelPrivate); } ; } }
69 CTK_TYPE_BOX,static void lapiz_taglist_plugin_panel_init (LapizTaglistPluginPanel
*self); static void lapiz_taglist_plugin_panel_class_init (LapizTaglistPluginPanelClass
*klass); static void lapiz_taglist_plugin_panel_class_finalize
(LapizTaglistPluginPanelClass *klass); static gpointer lapiz_taglist_plugin_panel_parent_class
= ((void*)0); static GType lapiz_taglist_plugin_panel_type_id
= 0; static gint LapizTaglistPluginPanel_private_offset; static
void lapiz_taglist_plugin_panel_class_intern_init (gpointer klass
) { lapiz_taglist_plugin_panel_parent_class = g_type_class_peek_parent
(klass); if (LapizTaglistPluginPanel_private_offset != 0) g_type_class_adjust_private_offset
(klass, &LapizTaglistPluginPanel_private_offset); lapiz_taglist_plugin_panel_class_init
((LapizTaglistPluginPanelClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer lapiz_taglist_plugin_panel_get_instance_private
(LapizTaglistPluginPanel *self) { return (((gpointer) ((guint8
*) (self) + (glong) (LapizTaglistPluginPanel_private_offset))
)); } GType lapiz_taglist_plugin_panel_get_type (void) { return
lapiz_taglist_plugin_panel_type_id; } static void lapiz_taglist_plugin_panel_register_type
(GTypeModule *type_module) { GType g_define_type_id __attribute__
((__unused__)); const GTypeInfo g_define_type_info = { sizeof
(LapizTaglistPluginPanelClass), (GBaseInitFunc) ((void*)0), (
GBaseFinalizeFunc) ((void*)0), (GClassInitFunc)(void (*)(void
)) lapiz_taglist_plugin_panel_class_intern_init, (GClassFinalizeFunc
)(void (*)(void)) lapiz_taglist_plugin_panel_class_finalize, (
(void*)0), sizeof (LapizTaglistPluginPanel), 0, (GInstanceInitFunc
)(void (*)(void)) lapiz_taglist_plugin_panel_init, ((void*)0)
}; lapiz_taglist_plugin_panel_type_id = g_type_module_register_type
(type_module, (ctk_box_get_type ()), "LapizTaglistPluginPanel"
, &g_define_type_info, (GTypeFlags) 0); g_define_type_id =
lapiz_taglist_plugin_panel_type_id; { { LapizTaglistPluginPanel_private_offset
= sizeof (LapizTaglistPluginPanelPrivate); } ; } }
70 0,static void lapiz_taglist_plugin_panel_init (LapizTaglistPluginPanel
*self); static void lapiz_taglist_plugin_panel_class_init (LapizTaglistPluginPanelClass
*klass); static void lapiz_taglist_plugin_panel_class_finalize
(LapizTaglistPluginPanelClass *klass); static gpointer lapiz_taglist_plugin_panel_parent_class
= ((void*)0); static GType lapiz_taglist_plugin_panel_type_id
= 0; static gint LapizTaglistPluginPanel_private_offset; static
void lapiz_taglist_plugin_panel_class_intern_init (gpointer klass
) { lapiz_taglist_plugin_panel_parent_class = g_type_class_peek_parent
(klass); if (LapizTaglistPluginPanel_private_offset != 0) g_type_class_adjust_private_offset
(klass, &LapizTaglistPluginPanel_private_offset); lapiz_taglist_plugin_panel_class_init
((LapizTaglistPluginPanelClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer lapiz_taglist_plugin_panel_get_instance_private
(LapizTaglistPluginPanel *self) { return (((gpointer) ((guint8
*) (self) + (glong) (LapizTaglistPluginPanel_private_offset))
)); } GType lapiz_taglist_plugin_panel_get_type (void) { return
lapiz_taglist_plugin_panel_type_id; } static void lapiz_taglist_plugin_panel_register_type
(GTypeModule *type_module) { GType g_define_type_id __attribute__
((__unused__)); const GTypeInfo g_define_type_info = { sizeof
(LapizTaglistPluginPanelClass), (GBaseInitFunc) ((void*)0), (
GBaseFinalizeFunc) ((void*)0), (GClassInitFunc)(void (*)(void
)) lapiz_taglist_plugin_panel_class_intern_init, (GClassFinalizeFunc
)(void (*)(void)) lapiz_taglist_plugin_panel_class_finalize, (
(void*)0), sizeof (LapizTaglistPluginPanel), 0, (GInstanceInitFunc
)(void (*)(void)) lapiz_taglist_plugin_panel_init, ((void*)0)
}; lapiz_taglist_plugin_panel_type_id = g_type_module_register_type
(type_module, (ctk_box_get_type ()), "LapizTaglistPluginPanel"
, &g_define_type_info, (GTypeFlags) 0); g_define_type_id =
lapiz_taglist_plugin_panel_type_id; { { LapizTaglistPluginPanel_private_offset
= sizeof (LapizTaglistPluginPanelPrivate); } ; } }
71 G_ADD_PRIVATE_DYNAMIC(LapizTaglistPluginPanel))static void lapiz_taglist_plugin_panel_init (LapizTaglistPluginPanel
*self); static void lapiz_taglist_plugin_panel_class_init (LapizTaglistPluginPanelClass
*klass); static void lapiz_taglist_plugin_panel_class_finalize
(LapizTaglistPluginPanelClass *klass); static gpointer lapiz_taglist_plugin_panel_parent_class
= ((void*)0); static GType lapiz_taglist_plugin_panel_type_id
= 0; static gint LapizTaglistPluginPanel_private_offset; static
void lapiz_taglist_plugin_panel_class_intern_init (gpointer klass
) { lapiz_taglist_plugin_panel_parent_class = g_type_class_peek_parent
(klass); if (LapizTaglistPluginPanel_private_offset != 0) g_type_class_adjust_private_offset
(klass, &LapizTaglistPluginPanel_private_offset); lapiz_taglist_plugin_panel_class_init
((LapizTaglistPluginPanelClass*) klass); } __attribute__ ((__unused__
)) static inline gpointer lapiz_taglist_plugin_panel_get_instance_private
(LapizTaglistPluginPanel *self) { return (((gpointer) ((guint8
*) (self) + (glong) (LapizTaglistPluginPanel_private_offset))
)); } GType lapiz_taglist_plugin_panel_get_type (void) { return
lapiz_taglist_plugin_panel_type_id; } static void lapiz_taglist_plugin_panel_register_type
(GTypeModule *type_module) { GType g_define_type_id __attribute__
((__unused__)); const GTypeInfo g_define_type_info = { sizeof
(LapizTaglistPluginPanelClass), (GBaseInitFunc) ((void*)0), (
GBaseFinalizeFunc) ((void*)0), (GClassInitFunc)(void (*)(void
)) lapiz_taglist_plugin_panel_class_intern_init, (GClassFinalizeFunc
)(void (*)(void)) lapiz_taglist_plugin_panel_class_finalize, (
(void*)0), sizeof (LapizTaglistPluginPanel), 0, (GInstanceInitFunc
)(void (*)(void)) lapiz_taglist_plugin_panel_init, ((void*)0)
}; lapiz_taglist_plugin_panel_type_id = g_type_module_register_type
(type_module, (ctk_box_get_type ()), "LapizTaglistPluginPanel"
, &g_define_type_info, (GTypeFlags) 0); g_define_type_id =
lapiz_taglist_plugin_panel_type_id; { { LapizTaglistPluginPanel_private_offset
= sizeof (LapizTaglistPluginPanelPrivate); } ; } }
72
73enum
74{
75 PROP_0,
76 PROP_WINDOW,
77};
78
79static void
80set_window (LapizTaglistPluginPanel *panel,
81 LapizWindow *window)
82{
83 g_return_if_fail (panel->priv->window == NULL)do { if ((panel->priv->window == ((void*)0))) { } else {
g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__
)), "panel->priv->window == NULL"); return; } } while (
0)
;
84 g_return_if_fail (LAPIZ_IS_WINDOW (window))do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((lapiz_window_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "LAPIZ_IS_WINDOW (window)"); return; } } while
(0)
;
85
86 panel->priv->window = window;
87
88 /* TODO */
89}
90
91static void
92lapiz_taglist_plugin_panel_set_property (GObject *object,
93 guint prop_id,
94 const GValue *value,
95 GParamSpec *pspec)
96{
97 LapizTaglistPluginPanel *panel = LAPIZ_TAGLIST_PLUGIN_PANEL (object)((((LapizTaglistPluginPanel*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((object)), ((lapiz_taglist_plugin_panel_get_type
()))))))
;
98
99 switch (prop_id)
100 {
101 case PROP_WINDOW:
102 set_window (panel, g_value_get_object (value));
103 break;
104
105 default:
106 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "lapiz-taglist-plugin-panel.c", 106, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
107 break;
108 }
109}
110
111static void
112lapiz_taglist_plugin_panel_get_property (GObject *object,
113 guint prop_id,
114 GValue *value,
115 GParamSpec *pspec)
116{
117 LapizTaglistPluginPanel *panel = LAPIZ_TAGLIST_PLUGIN_PANEL (object)((((LapizTaglistPluginPanel*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((object)), ((lapiz_taglist_plugin_panel_get_type
()))))))
;
118
119 switch (prop_id)
120 {
121 case PROP_WINDOW:
122 panel->priv = lapiz_taglist_plugin_panel_get_instance_private (panel);
123 g_value_set_object (value, panel->priv->window);
124 break;
125 default:
126 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec)do { GObject *_glib__object = (GObject*) ((object)); GParamSpec
*_glib__pspec = (GParamSpec*) ((pspec)); guint _glib__property_id
= ((prop_id)); g_warning ("%s:%d: invalid %s id %u for \"%s\" of type '%s' in '%s'"
, "lapiz-taglist-plugin-panel.c", 126, ("property"), _glib__property_id
, _glib__pspec->name, g_type_name ((((((GTypeClass*) (((GTypeInstance
*) (_glib__pspec))->g_class))->g_type)))), (g_type_name
((((((GTypeClass*) (((GTypeInstance*) (_glib__object))->g_class
))->g_type)))))); } while (0)
;
127 break;
128 }
129}
130
131static void
132lapiz_taglist_plugin_panel_finalize (GObject *object)
133{
134 LapizTaglistPluginPanel *panel = LAPIZ_TAGLIST_PLUGIN_PANEL (object)((((LapizTaglistPluginPanel*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((object)), ((lapiz_taglist_plugin_panel_get_type
()))))))
;
135
136 g_free (panel->priv->data_dir);
137
138 G_OBJECT_CLASS (lapiz_taglist_plugin_panel_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((lapiz_taglist_plugin_panel_parent_class)), (((GType) ((20
) << (2))))))))
->finalize (object);
139}
140
141static void
142lapiz_taglist_plugin_panel_class_init (LapizTaglistPluginPanelClass *klass)
143{
144 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
145
146 object_class->finalize = lapiz_taglist_plugin_panel_finalize;
147 object_class->get_property = lapiz_taglist_plugin_panel_get_property;
148 object_class->set_property = lapiz_taglist_plugin_panel_set_property;
149
150 g_object_class_install_property (object_class,
151 PROP_WINDOW,
152 g_param_spec_object ("window",
153 "Window",
154 "The LapizWindow this LapizTaglistPluginPanel is associated with",
155 LAPIZ_TYPE_WINDOW(lapiz_window_get_type()),
156 G_PARAM_READWRITE |
157 G_PARAM_CONSTRUCT_ONLY));
158}
159
160static void
161lapiz_taglist_plugin_panel_class_finalize (LapizTaglistPluginPanelClass *klass G_GNUC_UNUSED__attribute__ ((__unused__)))
162{
163 /* dummy function - used by G_DEFINE_DYNAMIC_TYPE_EXTENDED */
164}
165
166static void
167insert_tag (LapizTaglistPluginPanel *panel,
168 Tag *tag,
169 gboolean grab_focus)
170{
171 LapizView *view;
172 CtkTextBuffer *buffer;
173 CtkTextIter start, end;
174 CtkTextIter cursor;
175 gboolean sel = FALSE(0);
176
177 lapiz_debug (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 177, ((const
char*) (__func__))
);
178
179 view = lapiz_window_get_active_view (panel->priv->window);
180 g_return_if_fail (view != NULL)do { if ((view != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "view != NULL"); return
; } } while (0)
;
181
182 buffer = ctk_text_view_get_buffer (CTK_TEXT_VIEW (view)((((CtkTextView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((view)), ((ctk_text_view_get_type ()))))))
);
183
184 ctk_text_buffer_begin_user_action (buffer);
185
186 /* always insert the begin tag at the beginning of the selection
187 * and the end tag at the end, if there is no selection they will
188 * be automatically inserted at the cursor position.
189 */
190
191 if (tag->begin != NULL((void*)0))
192 {
193 sel = ctk_text_buffer_get_selection_bounds (buffer,
Value stored to 'sel' is never read
194 &start,
195 &end);
196
197 ctk_text_buffer_insert (buffer,
198 &start,
199 (gchar *)tag->begin,
200 -1);
201
202 /* get iterators again since they have been invalidated and move
203 * the cursor after the selection */
204 ctk_text_buffer_get_selection_bounds (buffer,
205 &start,
206 &cursor);
207 }
208
209 if (tag->end != NULL((void*)0))
210 {
211 sel = ctk_text_buffer_get_selection_bounds (buffer,
212 &start,
213 &end);
214
215 ctk_text_buffer_insert (buffer,
216 &end,
217 (gchar *)tag->end,
218 -1);
219
220 /* if there is no selection and we have a paired tag, move the
221 * cursor between the pair, otherwise move it at the end */
222 if (!sel)
223 {
224 gint offset;
225
226 offset = ctk_text_iter_get_offset (&end) -
227 g_utf8_strlen ((gchar *)tag->end, -1);
228
229 ctk_text_buffer_get_iter_at_offset (buffer,
230 &end,
231 offset);
232 }
233
234 cursor = end;
235 }
236
237 ctk_text_buffer_place_cursor (buffer, &cursor);
238
239 ctk_text_buffer_end_user_action (buffer);
240
241 if (grab_focus)
242 ctk_widget_grab_focus (CTK_WIDGET (view)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((view)), ((ctk_widget_get_type ()))))))
);
243}
244
245static void
246tag_list_row_activated_cb (CtkTreeView *tag_list,
247 CtkTreePath *path,
248 CtkTreeViewColumn *column G_GNUC_UNUSED__attribute__ ((__unused__)),
249 LapizTaglistPluginPanel *panel)
250{
251 CtkTreeIter iter;
252 CtkTreeModel *model;
253 gint index;
254
255 lapiz_debug (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 255, ((const
char*) (__func__))
);
256
257 model = ctk_tree_view_get_model (tag_list);
258
259 ctk_tree_model_get_iter (model, &iter, path);
260 g_return_if_fail (&iter != NULL)do { if ((&iter != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "&iter != NULL"
); return; } } while (0)
;
261
262 ctk_tree_model_get (model, &iter, COLUMN_TAG_INDEX_IN_GROUP, &index, -1);
263
264 lapiz_debug_message (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 264, ((const
char*) (__func__))
, "Index: %d", index);
265
266 insert_tag (panel,
267 (Tag*)g_list_nth_data (panel->priv->selected_tag_group->tags, index),
268 TRUE(!(0)));
269}
270
271static gboolean
272tag_list_key_press_event_cb (CtkTreeView *tag_list,
273 CdkEventKey *event,
274 LapizTaglistPluginPanel *panel)
275{
276 gboolean grab_focus;
277
278 grab_focus = (event->state & CDK_CONTROL_MASK) != 0;
279
280 if (event->keyval == CDK_KEY_Return0xff0d)
281 {
282 CtkTreeModel *model;
283 CtkTreeSelection *selection;
284 CtkTreeIter iter;
285 gint index;
286
287 lapiz_debug_message (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 287, ((const
char*) (__func__))
, "RETURN Pressed");
288
289 model = ctk_tree_view_get_model (tag_list);
290
291 selection = ctk_tree_view_get_selection (tag_list);
292
293 if (ctk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
294 {
295 ctk_tree_model_get (model, &iter, COLUMN_TAG_INDEX_IN_GROUP, &index, -1);
296
297 lapiz_debug_message (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 297, ((const
char*) (__func__))
, "Index: %d", index);
298
299 insert_tag (panel,
300 (Tag*)g_list_nth_data (panel->priv->selected_tag_group->tags, index),
301 grab_focus);
302 }
303
304 return TRUE(!(0));
305 }
306
307 return FALSE(0);
308}
309
310static CtkTreeModel*
311create_model (LapizTaglistPluginPanel *panel)
312{
313 gint i = 0;
314 CtkListStore *store;
315 CtkTreeIter iter;
316 GList *list;
317
318 lapiz_debug (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 318, ((const
char*) (__func__))
);
319
320 /* create list store */
321 store = ctk_list_store_new (NUM_COLUMNS, G_TYPE_STRING((GType) ((16) << (2))), G_TYPE_INT((GType) ((6) << (2))));
322
323 /* add data to the list store */
324 list = panel->priv->selected_tag_group->tags;
325
326 while (list != NULL((void*)0))
327 {
328 const gchar* tag_name;
329
330 tag_name = (gchar *)((Tag*)list->data)->name;
331
332 lapiz_debug_message (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 332, ((const
char*) (__func__))
, "%d : %s", i, tag_name);
333
334 ctk_list_store_append (store, &iter);
335 ctk_list_store_set (store, &iter,
336 COLUMN_TAG_NAME, tag_name,
337 COLUMN_TAG_INDEX_IN_GROUP, i,
338 -1);
339 ++i;
340
341 list = g_list_next (list)((list) ? (((GList *)(list))->next) : ((void*)0));
342 }
343
344 lapiz_debug_message (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 344, ((const
char*) (__func__))
, "Rows: %d ",
345 ctk_tree_model_iter_n_children (CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((ctk_tree_model_get_type ()))))))
, NULL((void*)0)));
346
347 return CTK_TREE_MODEL (store)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((store)), ((ctk_tree_model_get_type ()))))))
;
348}
349
350static void
351populate_tags_list (LapizTaglistPluginPanel *panel)
352{
353 CtkTreeModel* model;
354
355 lapiz_debug (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 355, ((const
char*) (__func__))
);
356
357 g_return_if_fail (taglist != NULL)do { if ((taglist != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "taglist != NULL"
); return; } } while (0)
;
358
359 model = create_model (panel);
360 ctk_tree_view_set_model (CTK_TREE_VIEW (panel->priv->tags_list)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->tags_list)), ((ctk_tree_view_get_type
()))))))
,
361 model);
362 g_object_unref (model);
363}
364
365static TagGroup *
366find_tag_group (const gchar *name)
367{
368 GList *l;
369
370 lapiz_debug (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 370, ((const
char*) (__func__))
);
371
372 g_return_val_if_fail (taglist != NULL, NULL)do { if ((taglist != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "taglist != NULL"
); return (((void*)0)); } } while (0)
;
373
374 for (l = taglist->tag_groups; l != NULL((void*)0); l = g_list_next (l)((l) ? (((GList *)(l))->next) : ((void*)0)))
375 {
376 if (strcmp (name, (gchar *)((TagGroup*)l->data)->name) == 0)
377 return (TagGroup*)l->data;
378 }
379
380 return NULL((void*)0);
381}
382
383static void
384populate_tag_groups_combo (LapizTaglistPluginPanel *panel)
385{
386 GList *l;
387 CtkComboBox *combo;
388 CtkComboBoxText *combotext;
389
390 lapiz_debug (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 390, ((const
char*) (__func__))
);
391
392 combo = CTK_COMBO_BOX (panel->priv->tag_groups_combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->tag_groups_combo)), ((ctk_combo_box_get_type
()))))))
;
393 combotext = CTK_COMBO_BOX_TEXT (panel->priv->tag_groups_combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->tag_groups_combo)), ((ctk_combo_box_text_get_type
()))))))
;
394
395 if (taglist == NULL((void*)0))
396 return;
397
398 for (l = taglist->tag_groups; l != NULL((void*)0); l = g_list_next (l)((l) ? (((GList *)(l))->next) : ((void*)0)))
399 {
400 ctk_combo_box_text_append_text (combotext,
401 (gchar *)((TagGroup*)l->data)->name);
402 }
403
404 ctk_combo_box_set_active (combo, 0);
405
406 return;
407}
408
409static void
410selected_group_changed (CtkComboBox *combo,
411 LapizTaglistPluginPanel *panel)
412{
413 gchar* group_name;
414
415 lapiz_debug (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 415, ((const
char*) (__func__))
);
416
417 group_name = ctk_combo_box_text_get_active_text (CTK_COMBO_BOX_TEXT (combo)((((CtkComboBoxText*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_combo_box_text_get_type ()))))))
);
418
419 if ((group_name == NULL((void*)0)) || (strlen (group_name) <= 0))
420 {
421 g_free (group_name);
422 return;
423 }
424
425 if ((panel->priv->selected_tag_group == NULL((void*)0)) ||
426 (strcmp (group_name, (gchar *)panel->priv->selected_tag_group->name) != 0))
427 {
428 panel->priv->selected_tag_group = find_tag_group (group_name);
429 g_return_if_fail (panel->priv->selected_tag_group != NULL)do { if ((panel->priv->selected_tag_group != ((void*)0)
)) { } else { g_return_if_fail_warning (((gchar*) 0), ((const
char*) (__func__)), "panel->priv->selected_tag_group != NULL"
); return; } } while (0)
;
430
431 lapiz_debug_message (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 431, ((const
char*) (__func__))
,
432 "New selected group: %s",
433 panel->priv->selected_tag_group->name);
434
435 populate_tags_list (panel);
436 }
437
438 /* Clean up preview */
439 ctk_label_set_text (CTK_LABEL (panel->priv->preview)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->preview)), ((ctk_label_get_type ())))
)))
,
440 "");
441
442 g_free (group_name);
443}
444
445static gchar *
446create_preview_string (Tag *tag)
447{
448 GString *str;
449
450 str = g_string_new ("<tt><small>");
451
452 if (tag->begin != NULL((void*)0))
453 {
454 gchar *markup;
455
456 markup = g_markup_escape_text ((gchar *)tag->begin, -1);
457 g_string_append (str, markup)(__builtin_constant_p (markup) ? __extension__ ({ const char *
const __val = (markup); g_string_append_len_inline (str, __val
, (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val
))) : (gssize) -1); }) : g_string_append_len_inline (str, markup
, (gssize) -1))
;
458 g_free (markup);
459 }
460
461 if (tag->end != NULL((void*)0))
462 {
463 gchar *markup;
464
465 markup = g_markup_escape_text ((gchar *)tag->end, -1);
466 g_string_append (str, markup)(__builtin_constant_p (markup) ? __extension__ ({ const char *
const __val = (markup); g_string_append_len_inline (str, __val
, (__val != ((void*)0)) ? (gssize) strlen (((__val) + !(__val
))) : (gssize) -1); }) : g_string_append_len_inline (str, markup
, (gssize) -1))
;
467 g_free (markup);
468 }
469
470 g_string_append (str, "</small></tt>")(__builtin_constant_p ("</small></tt>") ? __extension__
({ const char * const __val = ("</small></tt>");
g_string_append_len_inline (str, __val, (__val != ((void*)0)
) ? (gssize) strlen (((__val) + !(__val))) : (gssize) -1); })
: g_string_append_len_inline (str, "</small></tt>"
, (gssize) -1))
;
471
472 return g_string_free (str, FALSE)(__builtin_constant_p ((0)) ? (((0)) ? (g_string_free) ((str)
, ((0))) : g_string_free_and_steal (str)) : (g_string_free) (
(str), ((0))))
;
473}
474
475static void
476update_preview (LapizTaglistPluginPanel *panel,
477 Tag *tag)
478{
479 gchar *str;
480
481 str = create_preview_string (tag);
482
483 ctk_label_set_markup (CTK_LABEL (panel->priv->preview)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->preview)), ((ctk_label_get_type ())))
)))
,
484 str);
485
486 g_free (str);
487}
488
489static void
490tag_list_cursor_changed_cb (CtkTreeView *tag_list,
491 gpointer data)
492{
493 CtkTreeModel *model;
494 CtkTreeSelection *selection;
495 CtkTreeIter iter;
496 gint index;
497
498 LapizTaglistPluginPanel *panel = (LapizTaglistPluginPanel *)data;
499
500 model = ctk_tree_view_get_model (tag_list);
501
502 selection = ctk_tree_view_get_selection (tag_list);
503
504 if (ctk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
505 {
506 ctk_tree_model_get (model, &iter, COLUMN_TAG_INDEX_IN_GROUP, &index, -1);
507
508 lapiz_debug_message (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 508, ((const
char*) (__func__))
, "Index: %d", index);
509
510 update_preview (panel,
511 (Tag*)g_list_nth_data (panel->priv->selected_tag_group->tags, index));
512 }
513}
514
515static gboolean
516tags_list_query_tooltip_cb (CtkWidget *widget,
517 gint x,
518 gint y,
519 gboolean keyboard_tip,
520 CtkTooltip *tooltip,
521 LapizTaglistPluginPanel *panel)
522{
523 CtkTreeIter iter;
524 CtkTreeModel *model;
525 CtkTreePath *path = NULL((void*)0);
526 gint index;
527 Tag *tag;
528
529 model = ctk_tree_view_get_model (CTK_TREE_VIEW (widget)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_tree_view_get_type ()))))))
);
530
531 if (keyboard_tip)
532 {
533 ctk_tree_view_get_cursor (CTK_TREE_VIEW (widget)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_tree_view_get_type ()))))))
,
534 &path,
535 NULL((void*)0));
536
537 if (path == NULL((void*)0))
538 {
539 return FALSE(0);
540 }
541 }
542 else
543 {
544 gint bin_x, bin_y;
545
546 ctk_tree_view_convert_widget_to_bin_window_coords (CTK_TREE_VIEW (widget)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_tree_view_get_type ()))))))
,
547 x, y,
548 &bin_x, &bin_y);
549
550 if (!ctk_tree_view_get_path_at_pos (CTK_TREE_VIEW (widget)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_tree_view_get_type ()))))))
,
551 bin_x, bin_y,
552 &path,
553 NULL((void*)0), NULL((void*)0), NULL((void*)0)))
554 {
555 return FALSE(0);
556 }
557 }
558
559 ctk_tree_model_get_iter (model, &iter, path);
560 ctk_tree_model_get (model, &iter,
561 COLUMN_TAG_INDEX_IN_GROUP, &index,
562 -1);
563
564 tag = g_list_nth_data (panel->priv->selected_tag_group->tags, index);
565 if (tag != NULL((void*)0))
566 {
567 gchar *tip;
568
569 tip = create_preview_string (tag);
570 ctk_tooltip_set_markup (tooltip, tip);
571 g_free (tip);
572 ctk_tree_path_free (path);
573
574 return TRUE(!(0));
575 }
576
577 ctk_tree_path_free (path);
578
579 return FALSE(0);
580}
581
582static gboolean
583draw_event_cb (CtkWidget *panel,
584 cairo_t *cr G_GNUC_UNUSED__attribute__ ((__unused__)),
585 gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__)))
586{
587 LapizTaglistPluginPanel *ppanel = LAPIZ_TAGLIST_PLUGIN_PANEL (panel)((((LapizTaglistPluginPanel*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((panel)), ((lapiz_taglist_plugin_panel_get_type
()))))))
;
588
589 lapiz_debug (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 589, ((const
char*) (__func__))
);
590
591 /* If needed load taglists from files at the first expose */
592 if (taglist == NULL((void*)0))
593 create_taglist (ppanel->priv->data_dir);
594
595 /* And populate combo box */
596 populate_tag_groups_combo (LAPIZ_TAGLIST_PLUGIN_PANEL (panel)((((LapizTaglistPluginPanel*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((panel)), ((lapiz_taglist_plugin_panel_get_type
()))))))
);
597
598 /* We need to manage only the first draw -> disconnect */
599 g_signal_handlers_disconnect_by_func (panel, draw_event_cb, NULL)g_signal_handlers_disconnect_matched ((panel), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (draw_event_cb), (((void*)0)))
;
600
601 return FALSE(0);
602}
603
604static void
605set_combo_tooltip (CtkWidget *widget,
606 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
607{
608 if (CTK_IS_BUTTON (widget)(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (
(widget)); GType __t = ((ctk_button_get_type ())); gboolean __r
; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; }))))
)
609 {
610 ctk_widget_set_tooltip_text (widget,
611 _("Select the group of tags you want to use")gettext ("Select the group of tags you want to use"));
612 }
613}
614
615static void
616realize_tag_groups_combo (CtkWidget *combo,
617 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
618{
619 ctk_container_forall (CTK_CONTAINER (combo)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((combo)), ((ctk_container_get_type ()))))))
,
620 set_combo_tooltip,
621 NULL((void*)0));
622}
623
624static void
625add_preview_widget (LapizTaglistPluginPanel *panel)
626{
627 CtkWidget *expander;
628 CtkWidget *frame;
629
630 expander = ctk_expander_new_with_mnemonic (_("_Preview")gettext ("_Preview"));
631
632 panel->priv->preview = ctk_label_new (NULL((void*)0));
633 ctk_widget_set_size_request (panel->priv->preview, -1, 80);
634
635 ctk_label_set_line_wrap (CTK_LABEL (panel->priv->preview)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->preview)), ((ctk_label_get_type ())))
)))
, TRUE(!(0)));
636 ctk_label_set_use_markup (CTK_LABEL (panel->priv->preview)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->preview)), ((ctk_label_get_type ())))
)))
, TRUE(!(0)));
637 ctk_widget_set_halign (panel->priv->preview, CTK_ALIGN_START);
638 ctk_widget_set_valign (panel->priv->preview, CTK_ALIGN_START);
639 ctk_widget_set_margin_start (panel->priv->preview, 6);
640 ctk_widget_set_margin_end (panel->priv->preview, 6);
641 ctk_widget_set_margin_top (panel->priv->preview, 6);
642 ctk_widget_set_margin_bottom (panel->priv->preview, 6);
643 ctk_label_set_selectable (CTK_LABEL (panel->priv->preview)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->preview)), ((ctk_label_get_type ())))
)))
, TRUE(!(0)));
644 ctk_label_set_selectable (CTK_LABEL (panel->priv->preview)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->preview)), ((ctk_label_get_type ())))
)))
, TRUE(!(0)));
645 ctk_label_set_ellipsize (CTK_LABEL (panel->priv->preview)((((CtkLabel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->preview)), ((ctk_label_get_type ())))
)))
,
646 PANGO_ELLIPSIZE_END);
647
648 frame = ctk_frame_new (0);
649 ctk_frame_set_shadow_type (CTK_FRAME (frame)((((CtkFrame*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_frame_get_type ()))))))
, CTK_SHADOW_IN);
650
651 ctk_container_add (CTK_CONTAINER (frame)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((frame)), ((ctk_container_get_type ()))))))
,
652 panel->priv->preview);
653
654 ctk_container_add (CTK_CONTAINER (expander)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((expander)), ((ctk_container_get_type ()))))))
,
655 frame);
656
657 ctk_box_pack_start (CTK_BOX (panel)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel)), ((ctk_box_get_type ()))))))
, expander, FALSE(0), FALSE(0), 0);
658
659 ctk_widget_show_all (expander);
660}
661
662static void
663lapiz_taglist_plugin_panel_init (LapizTaglistPluginPanel *panel)
664{
665 CtkWidget *sw;
666 CtkTreeViewColumn *column;
667 CtkCellRenderer *cell;
668 GList *focus_chain = NULL((void*)0);
669
670 lapiz_debug (DEBUG_PLUGINSLAPIZ_DEBUG_PLUGINS, "lapiz-taglist-plugin-panel.c", 670, ((const
char*) (__func__))
);
671
672 panel->priv = lapiz_taglist_plugin_panel_get_instance_private (panel);
673 panel->priv->data_dir = NULL((void*)0);
674
675 ctk_orientable_set_orientation (CTK_ORIENTABLE (panel)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel)), ((ctk_orientable_get_type ()))))))
,
676 CTK_ORIENTATION_VERTICAL);
677
678 /* Build the window content */
679 panel->priv->tag_groups_combo = ctk_combo_box_text_new ();
680 ctk_box_pack_start (CTK_BOX (panel)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel)), ((ctk_box_get_type ()))))))
,
681 panel->priv->tag_groups_combo,
682 FALSE(0),
683 TRUE(!(0)),
684 0);
685
686 g_signal_connect (panel->priv->tag_groups_combo,g_signal_connect_data ((panel->priv->tag_groups_combo),
("realize"), (((GCallback) (realize_tag_groups_combo))), (panel
), ((void*)0), (GConnectFlags) 0)
687 "realize",g_signal_connect_data ((panel->priv->tag_groups_combo),
("realize"), (((GCallback) (realize_tag_groups_combo))), (panel
), ((void*)0), (GConnectFlags) 0)
688 G_CALLBACK (realize_tag_groups_combo),g_signal_connect_data ((panel->priv->tag_groups_combo),
("realize"), (((GCallback) (realize_tag_groups_combo))), (panel
), ((void*)0), (GConnectFlags) 0)
689 panel)g_signal_connect_data ((panel->priv->tag_groups_combo),
("realize"), (((GCallback) (realize_tag_groups_combo))), (panel
), ((void*)0), (GConnectFlags) 0)
;
690
691 sw = ctk_scrolled_window_new (NULL((void*)0), NULL((void*)0));
692
693 ctk_scrolled_window_set_policy (CTK_SCROLLED_WINDOW (sw)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((sw)), ((ctk_scrolled_window_get_type ())))
)))
,
694 CTK_POLICY_AUTOMATIC,
695 CTK_POLICY_AUTOMATIC);
696 ctk_scrolled_window_set_shadow_type (CTK_SCROLLED_WINDOW (sw)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((sw)), ((ctk_scrolled_window_get_type ())))
)))
,
697 CTK_SHADOW_IN);
698 ctk_box_pack_start (CTK_BOX (panel)((((CtkBox*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel)), ((ctk_box_get_type ()))))))
, sw, TRUE(!(0)), TRUE(!(0)), 0);
699
700 /* Create tree view */
701 panel->priv->tags_list = ctk_tree_view_new ();
702
703 lapiz_utils_set_atk_name_description (panel->priv->tag_groups_combo,
704 _("Available Tag Lists")gettext ("Available Tag Lists"),
705 NULL((void*)0));
706 lapiz_utils_set_atk_name_description (panel->priv->tags_list,
707 _("Tags")gettext ("Tags"),
708 NULL((void*)0));
709 lapiz_utils_set_atk_relation (panel->priv->tag_groups_combo,
710 panel->priv->tags_list,
711 ATK_RELATION_CONTROLLER_FOR);
712 lapiz_utils_set_atk_relation (panel->priv->tags_list,
713 panel->priv->tag_groups_combo,
714 ATK_RELATION_CONTROLLED_BY);
715
716 ctk_tree_view_set_headers_visible (CTK_TREE_VIEW (panel->priv->tags_list)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->tags_list)), ((ctk_tree_view_get_type
()))))))
, FALSE(0));
717
718 g_object_set (panel->priv->tags_list, "has-tooltip", TRUE(!(0)), NULL((void*)0));
719
720 /* Add the tags column */
721 cell = ctk_cell_renderer_text_new ();
722 column = ctk_tree_view_column_new_with_attributes (_("Tags")gettext ("Tags"),
723 cell,
724 "text",
725 COLUMN_TAG_NAME,
726 NULL((void*)0));
727 ctk_tree_view_append_column (CTK_TREE_VIEW (panel->priv->tags_list)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->tags_list)), ((ctk_tree_view_get_type
()))))))
,
728 column);
729
730 ctk_tree_view_set_search_column (CTK_TREE_VIEW (panel->priv->tags_list)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->tags_list)), ((ctk_tree_view_get_type
()))))))
,
731 COLUMN_TAG_NAME);
732
733 ctk_container_add (CTK_CONTAINER (sw)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sw)), ((ctk_container_get_type ()))))))
, panel->priv->tags_list);
734
735 focus_chain = g_list_prepend (focus_chain, panel->priv->tags_list);
736 focus_chain = g_list_prepend (focus_chain, panel->priv->tag_groups_combo);
737
738 ctk_container_set_focus_chain (CTK_CONTAINER (panel)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel)), ((ctk_container_get_type ()))))))
,
739 focus_chain);
740 g_list_free (focus_chain);
741
742 add_preview_widget (panel);
743
744 ctk_widget_show_all (CTK_WIDGET (sw)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sw)), ((ctk_widget_get_type ()))))))
);
745 ctk_widget_show (CTK_WIDGET (panel->priv->tag_groups_combo)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->tag_groups_combo)), ((ctk_widget_get_type
()))))))
);
746
747 g_signal_connect_after (panel->priv->tags_list,g_signal_connect_data ((panel->priv->tags_list), ("row_activated"
), (((GCallback) (tag_list_row_activated_cb))), (panel), ((void
*)0), G_CONNECT_AFTER)
748 "row_activated",g_signal_connect_data ((panel->priv->tags_list), ("row_activated"
), (((GCallback) (tag_list_row_activated_cb))), (panel), ((void
*)0), G_CONNECT_AFTER)
749 G_CALLBACK (tag_list_row_activated_cb),g_signal_connect_data ((panel->priv->tags_list), ("row_activated"
), (((GCallback) (tag_list_row_activated_cb))), (panel), ((void
*)0), G_CONNECT_AFTER)
750 panel)g_signal_connect_data ((panel->priv->tags_list), ("row_activated"
), (((GCallback) (tag_list_row_activated_cb))), (panel), ((void
*)0), G_CONNECT_AFTER)
;
751 g_signal_connect (panel->priv->tags_list,g_signal_connect_data ((panel->priv->tags_list), ("key_press_event"
), (((GCallback) (tag_list_key_press_event_cb))), (panel), ((
void*)0), (GConnectFlags) 0)
752 "key_press_event",g_signal_connect_data ((panel->priv->tags_list), ("key_press_event"
), (((GCallback) (tag_list_key_press_event_cb))), (panel), ((
void*)0), (GConnectFlags) 0)
753 G_CALLBACK (tag_list_key_press_event_cb),g_signal_connect_data ((panel->priv->tags_list), ("key_press_event"
), (((GCallback) (tag_list_key_press_event_cb))), (panel), ((
void*)0), (GConnectFlags) 0)
754 panel)g_signal_connect_data ((panel->priv->tags_list), ("key_press_event"
), (((GCallback) (tag_list_key_press_event_cb))), (panel), ((
void*)0), (GConnectFlags) 0)
;
755 g_signal_connect (panel->priv->tags_list,g_signal_connect_data ((panel->priv->tags_list), ("query-tooltip"
), (((GCallback) (tags_list_query_tooltip_cb))), (panel), ((void
*)0), (GConnectFlags) 0)
756 "query-tooltip",g_signal_connect_data ((panel->priv->tags_list), ("query-tooltip"
), (((GCallback) (tags_list_query_tooltip_cb))), (panel), ((void
*)0), (GConnectFlags) 0)
757 G_CALLBACK (tags_list_query_tooltip_cb),g_signal_connect_data ((panel->priv->tags_list), ("query-tooltip"
), (((GCallback) (tags_list_query_tooltip_cb))), (panel), ((void
*)0), (GConnectFlags) 0)
758 panel)g_signal_connect_data ((panel->priv->tags_list), ("query-tooltip"
), (((GCallback) (tags_list_query_tooltip_cb))), (panel), ((void
*)0), (GConnectFlags) 0)
;
759 g_signal_connect (panel->priv->tags_list,g_signal_connect_data ((panel->priv->tags_list), ("cursor_changed"
), (((GCallback) (tag_list_cursor_changed_cb))), (panel), ((void
*)0), (GConnectFlags) 0)
760 "cursor_changed",g_signal_connect_data ((panel->priv->tags_list), ("cursor_changed"
), (((GCallback) (tag_list_cursor_changed_cb))), (panel), ((void
*)0), (GConnectFlags) 0)
761 G_CALLBACK (tag_list_cursor_changed_cb),g_signal_connect_data ((panel->priv->tags_list), ("cursor_changed"
), (((GCallback) (tag_list_cursor_changed_cb))), (panel), ((void
*)0), (GConnectFlags) 0)
762 panel)g_signal_connect_data ((panel->priv->tags_list), ("cursor_changed"
), (((GCallback) (tag_list_cursor_changed_cb))), (panel), ((void
*)0), (GConnectFlags) 0)
;
763 g_signal_connect (panel->priv->tag_groups_combo,g_signal_connect_data ((panel->priv->tag_groups_combo),
("changed"), (((GCallback) (selected_group_changed))), (panel
), ((void*)0), (GConnectFlags) 0)
764 "changed",g_signal_connect_data ((panel->priv->tag_groups_combo),
("changed"), (((GCallback) (selected_group_changed))), (panel
), ((void*)0), (GConnectFlags) 0)
765 G_CALLBACK (selected_group_changed),g_signal_connect_data ((panel->priv->tag_groups_combo),
("changed"), (((GCallback) (selected_group_changed))), (panel
), ((void*)0), (GConnectFlags) 0)
766 panel)g_signal_connect_data ((panel->priv->tag_groups_combo),
("changed"), (((GCallback) (selected_group_changed))), (panel
), ((void*)0), (GConnectFlags) 0)
;
767 g_signal_connect (panel,g_signal_connect_data ((panel), ("draw"), (((GCallback) (draw_event_cb
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
768 "draw",g_signal_connect_data ((panel), ("draw"), (((GCallback) (draw_event_cb
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
769 G_CALLBACK (draw_event_cb),g_signal_connect_data ((panel), ("draw"), (((GCallback) (draw_event_cb
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
770 NULL)g_signal_connect_data ((panel), ("draw"), (((GCallback) (draw_event_cb
))), (((void*)0)), ((void*)0), (GConnectFlags) 0)
;
771}
772
773CtkWidget *
774lapiz_taglist_plugin_panel_new (LapizWindow *window,
775 const gchar *data_dir)
776{
777 LapizTaglistPluginPanel *panel;
778
779 g_return_val_if_fail (LAPIZ_IS_WINDOW (window), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((window)); GType __t = ((lapiz_window_get_type())); gboolean
__r; if (!__inst) __r = (0); else if (__inst->g_class &&
__inst->g_class->g_type == __t) __r = (!(0)); else __r
= g_type_check_instance_is_a (__inst, __t); __r; })))))) { }
else { g_return_if_fail_warning (((gchar*) 0), ((const char*
) (__func__)), "LAPIZ_IS_WINDOW (window)"); return (((void*)0
)); } } while (0)
;
780
781 panel = g_object_new (LAPIZ_TYPE_TAGLIST_PLUGIN_PANEL(lapiz_taglist_plugin_panel_get_type()),
782 "window", window,
783 NULL((void*)0));
784
785 panel->priv->data_dir = g_strdup (data_dir)g_strdup_inline (data_dir);
786
787 return CTK_WIDGET (panel)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel)), ((ctk_widget_get_type ()))))))
;
788}
789
790void
791_lapiz_taglist_plugin_panel_register_type (GTypeModule *type_module)
792{
793 lapiz_taglist_plugin_panel_register_type (type_module);
794}