Bug Summary

File:lapiz/lapiz-documents-panel.c
Warning:line 610, column 33
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption

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-documents-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/lapiz -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I .. -I .. -I . -I ./smclient -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 -I /usr/include/gobject-introspection-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -D DATADIR="/usr/share" -D LAPIZ_DATADIR="/usr/share/lapiz" -D LIBDIR="/usr/lib" -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/lapiz -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-16-235558-33763-1 -x c lapiz-documents-panel.c
1/*
2 * lapiz-documents-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 "lapiz-documents-panel.h"
36#include "lapiz-utils.h"
37#include "lapiz-notebook.h"
38
39#include <glib/gi18n.h>
40
41struct _LapizDocumentsPanelPrivate
42{
43 LapizWindow *window;
44
45 CtkWidget *treeview;
46 CtkTreeModel *model;
47
48 guint adding_tab : 1;
49 guint is_reodering : 1;
50};
51
52G_DEFINE_TYPE_WITH_PRIVATE (LapizDocumentsPanel, lapiz_documents_panel, CTK_TYPE_BOX)static void lapiz_documents_panel_init (LapizDocumentsPanel *
self); static void lapiz_documents_panel_class_init (LapizDocumentsPanelClass
*klass); static GType lapiz_documents_panel_get_type_once (void
); static gpointer lapiz_documents_panel_parent_class = ((void
*)0); static gint LapizDocumentsPanel_private_offset; static void
lapiz_documents_panel_class_intern_init (gpointer klass) { lapiz_documents_panel_parent_class
= g_type_class_peek_parent (klass); if (LapizDocumentsPanel_private_offset
!= 0) g_type_class_adjust_private_offset (klass, &LapizDocumentsPanel_private_offset
); lapiz_documents_panel_class_init ((LapizDocumentsPanelClass
*) klass); } __attribute__ ((__unused__)) static inline gpointer
lapiz_documents_panel_get_instance_private (LapizDocumentsPanel
*self) { return (((gpointer) ((guint8*) (self) + (glong) (LapizDocumentsPanel_private_offset
)))); } GType lapiz_documents_panel_get_type (void) { static GType
static_g_define_type_id = 0; if ((__extension__ ({ _Static_assert
(sizeof *(&static_g_define_type_id) == sizeof (gpointer)
, "Expression evaluates to false"); (void) (0 ? (gpointer) * (
&static_g_define_type_id) : ((void*)0)); (!(__extension__
({ _Static_assert (sizeof *(&static_g_define_type_id) ==
sizeof (gpointer), "Expression evaluates to false"); __typeof__
(*(&static_g_define_type_id)) gapg_temp_newval; __typeof__
((&static_g_define_type_id)) gapg_temp_atomic = (&static_g_define_type_id
); __atomic_load (gapg_temp_atomic, &gapg_temp_newval, 5)
; gapg_temp_newval; })) && g_once_init_enter_pointer (
&static_g_define_type_id)); })) ) { GType g_define_type_id
= lapiz_documents_panel_get_type_once (); (__extension__ ({ _Static_assert
(sizeof *(&static_g_define_type_id) == sizeof (gpointer)
, "Expression evaluates to false"); 0 ? (void) (*(&static_g_define_type_id
) = (g_define_type_id)) : (void) 0; g_once_init_leave_pointer
((&static_g_define_type_id), (gpointer) (guintptr) (g_define_type_id
)); })) ; } return static_g_define_type_id; } __attribute__ (
(__noinline__)) static GType lapiz_documents_panel_get_type_once
(void) { GType g_define_type_id = g_type_register_static_simple
((ctk_box_get_type ()), g_intern_static_string ("LapizDocumentsPanel"
), sizeof (LapizDocumentsPanelClass), (GClassInitFunc)(void (
*)(void)) lapiz_documents_panel_class_intern_init, sizeof (LapizDocumentsPanel
), (GInstanceInitFunc)(void (*)(void)) lapiz_documents_panel_init
, (GTypeFlags) 0); { {{ LapizDocumentsPanel_private_offset = g_type_add_instance_private
(g_define_type_id, sizeof (LapizDocumentsPanelPrivate)); };}
} return g_define_type_id; }
53
54enum
55{
56 PROP_0,
57 PROP_WINDOW
58};
59
60enum
61{
62 PIXBUF_COLUMN,
63 NAME_COLUMN,
64 TAB_COLUMN,
65 N_COLUMNS
66};
67
68#define MAX_DOC_NAME_LENGTH60 60
69
70static gchar *
71tab_get_name (LapizTab *tab)
72{
73 LapizDocument *doc;
74 gchar *name;
75 gchar *docname;
76 gchar *tab_name;
77
78 g_return_val_if_fail (LAPIZ_IS_TAB (tab), NULL)do { if (((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance
*) ((tab)); GType __t = ((lapiz_tab_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_TAB (tab)"); return (((void*)0)); } }
while (0)
;
79
80 doc = lapiz_tab_get_document (tab);
81
82 name = lapiz_document_get_short_name_for_display (doc);
83
84 /* Truncate the name so it doesn't get insanely wide. */
85 docname = lapiz_utils_str_middle_truncate (name, MAX_DOC_NAME_LENGTH60);
86
87 if (ctk_text_buffer_get_modified (CTK_TEXT_BUFFER (doc)((((CtkTextBuffer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((doc)), ((ctk_text_buffer_get_type ()))))))
))
88 {
89 if (lapiz_document_get_readonly (doc))
90 {
91 tab_name = g_markup_printf_escaped ("<i>%s</i> [<i>%s</i>]",
92 docname,
93 _("Read-Only")gettext ("Read-Only"));
94 }
95 else
96 {
97 tab_name = g_markup_printf_escaped ("<i>%s</i>",
98 docname);
99 }
100 }
101 else
102 {
103 if (lapiz_document_get_readonly (doc))
104 {
105 tab_name = g_markup_printf_escaped ("%s [<i>%s</i>]",
106 docname,
107 _("Read-Only")gettext ("Read-Only"));
108 }
109 else
110 {
111 tab_name = g_markup_escape_text (docname, -1);
112 }
113 }
114
115 g_free (docname);
116 g_free (name);
117
118 return tab_name;
119}
120
121static void
122get_iter_from_tab (LapizDocumentsPanel *panel, LapizTab *tab, CtkTreeIter *iter)
123{
124 gint num;
125 CtkWidget *nb;
126 CtkTreePath *path;
127
128 nb = _lapiz_window_get_notebook (panel->priv->window);
129 num = ctk_notebook_page_num (CTK_NOTEBOOK (nb)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((nb)), ((ctk_notebook_get_type ()))))))
,
130 CTK_WIDGET (tab)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tab)), ((ctk_widget_get_type ()))))))
);
131
132 path = ctk_tree_path_new_from_indices (num, -1);
133 ctk_tree_model_get_iter (panel->priv->model,
134 iter,
135 path);
136 ctk_tree_path_free (path);
137}
138
139static void
140window_active_tab_changed (LapizWindow *window,
141 LapizTab *tab,
142 LapizDocumentsPanel *panel)
143{
144 g_return_if_fail (tab != NULL)do { if ((tab != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "tab != NULL"); return
; } } while (0)
;
145
146 if (!_lapiz_window_is_removing_tabs (window))
147 {
148 CtkTreeIter iter;
149
150 get_iter_from_tab (panel, tab, &iter);
151
152 if (ctk_list_store_iter_is_valid (CTK_LIST_STORE (panel->priv->model)((((CtkListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->model)), ((ctk_list_store_get_type ()
))))))
,
153 &iter))
154 {
155 CtkTreeSelection *selection;
156
157 selection = ctk_tree_view_get_selection (
158 CTK_TREE_VIEW (panel->priv->treeview)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->treeview)), ((ctk_tree_view_get_type (
)))))))
);
159
160 ctk_tree_selection_select_iter (selection, &iter);
161 }
162 }
163}
164
165static void
166refresh_list (LapizDocumentsPanel *panel)
167{
168 /* TODO: refresh the list only if the panel is visible */
169
170 GList *tabs;
171 GList *l;
172 CtkWidget *nb;
173 CtkListStore *list_store;
174 LapizTab *active_tab;
175
176 /* g_debug ("refresh_list"); */
177
178 list_store = CTK_LIST_STORE (panel->priv->model)((((CtkListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->model)), ((ctk_list_store_get_type ()
))))))
;
179
180 ctk_list_store_clear (list_store);
181
182 active_tab = lapiz_window_get_active_tab (panel->priv->window);
183
184 nb = _lapiz_window_get_notebook (panel->priv->window);
185
186 tabs = ctk_container_get_children (CTK_CONTAINER (nb)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((nb)), ((ctk_container_get_type ()))))))
);
187 l = tabs;
188
189 panel->priv->adding_tab = TRUE(!(0));
190
191 while (l != NULL((void*)0))
192 {
193 GdkPixbuf *pixbuf;
194 gchar *name;
195 CtkTreeIter iter;
196
197 name = tab_get_name (LAPIZ_TAB (l->data)((((LapizTab*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((lapiz_tab_get_type()))))))
);
198 pixbuf = _lapiz_tab_get_icon (LAPIZ_TAB (l->data)((((LapizTab*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((l->data)), ((lapiz_tab_get_type()))))))
);
199
200 /* Add a new row to the model */
201 ctk_list_store_append (list_store, &iter);
202 ctk_list_store_set (list_store,
203 &iter,
204 PIXBUF_COLUMN, pixbuf,
205 NAME_COLUMN, name,
206 TAB_COLUMN, l->data,
207 -1);
208
209 g_free (name);
210 if (pixbuf != NULL((void*)0))
211 g_object_unref (pixbuf);
212
213 if (l->data == active_tab)
214 {
215 CtkTreeSelection *selection;
216
217 selection = ctk_tree_view_get_selection (
218 CTK_TREE_VIEW (panel->priv->treeview)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->treeview)), ((ctk_tree_view_get_type (
)))))))
);
219
220 ctk_tree_selection_select_iter (selection, &iter);
221 }
222
223 l = g_list_next (l)((l) ? (((GList *)(l))->next) : ((void*)0));
224 }
225
226 panel->priv->adding_tab = FALSE(0);
227
228 g_list_free (tabs);
229}
230
231static void
232sync_name_and_icon (LapizTab *tab,
233 GParamSpec *pspec G_GNUC_UNUSED__attribute__ ((__unused__)),
234 LapizDocumentsPanel *panel)
235{
236 GdkPixbuf *pixbuf;
237 gchar *name;
238 CtkTreeIter iter;
239
240 get_iter_from_tab (panel, tab, &iter);
241
242 name = tab_get_name (tab);
243 pixbuf = _lapiz_tab_get_icon (tab);
244
245 ctk_list_store_set (CTK_LIST_STORE (panel->priv->model)((((CtkListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->model)), ((ctk_list_store_get_type ()
))))))
,
246 &iter,
247 PIXBUF_COLUMN, pixbuf,
248 NAME_COLUMN, name,
249 TAB_COLUMN, tab,
250 -1);
251
252 g_free (name);
253 if (pixbuf != NULL((void*)0))
254 g_object_unref (pixbuf);
255}
256
257static void
258window_tab_removed (LapizWindow *window,
259 LapizTab *tab,
260 LapizDocumentsPanel *panel)
261{
262 g_signal_handlers_disconnect_by_func (tab,g_signal_handlers_disconnect_matched ((tab), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (sync_name_and_icon))), (panel))
263 G_CALLBACK (sync_name_and_icon),g_signal_handlers_disconnect_matched ((tab), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (sync_name_and_icon))), (panel))
264 panel)g_signal_handlers_disconnect_matched ((tab), (GSignalMatchType
) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA), 0, 0, ((void*)
0), (((GCallback) (sync_name_and_icon))), (panel))
;
265
266 if (_lapiz_window_is_removing_tabs (window))
267 ctk_list_store_clear (CTK_LIST_STORE (panel->priv->model)((((CtkListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->model)), ((ctk_list_store_get_type ()
))))))
);
268 else
269 refresh_list (panel);
270}
271
272static void
273window_tab_added (LapizWindow *window G_GNUC_UNUSED__attribute__ ((__unused__)),
274 LapizTab *tab,
275 LapizDocumentsPanel *panel)
276{
277 CtkTreeIter iter;
278 CtkTreeIter sibling;
279 GdkPixbuf *pixbuf;
280 gchar *name;
281
282 g_signal_connect (tab,g_signal_connect_data ((tab), ("notify::name"), (((GCallback)
(sync_name_and_icon))), (panel), ((void*)0), (GConnectFlags)
0)
283 "notify::name",g_signal_connect_data ((tab), ("notify::name"), (((GCallback)
(sync_name_and_icon))), (panel), ((void*)0), (GConnectFlags)
0)
284 G_CALLBACK (sync_name_and_icon),g_signal_connect_data ((tab), ("notify::name"), (((GCallback)
(sync_name_and_icon))), (panel), ((void*)0), (GConnectFlags)
0)
285 panel)g_signal_connect_data ((tab), ("notify::name"), (((GCallback)
(sync_name_and_icon))), (panel), ((void*)0), (GConnectFlags)
0)
;
286
287 g_signal_connect (tab,g_signal_connect_data ((tab), ("notify::state"), (((GCallback
) (sync_name_and_icon))), (panel), ((void*)0), (GConnectFlags
) 0)
288 "notify::state",g_signal_connect_data ((tab), ("notify::state"), (((GCallback
) (sync_name_and_icon))), (panel), ((void*)0), (GConnectFlags
) 0)
289 G_CALLBACK (sync_name_and_icon),g_signal_connect_data ((tab), ("notify::state"), (((GCallback
) (sync_name_and_icon))), (panel), ((void*)0), (GConnectFlags
) 0)
290 panel)g_signal_connect_data ((tab), ("notify::state"), (((GCallback
) (sync_name_and_icon))), (panel), ((void*)0), (GConnectFlags
) 0)
;
291
292 get_iter_from_tab (panel, tab, &sibling);
293
294 panel->priv->adding_tab = TRUE(!(0));
295
296 if (ctk_list_store_iter_is_valid (CTK_LIST_STORE (panel->priv->model)((((CtkListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->model)), ((ctk_list_store_get_type ()
))))))
,
297 &sibling))
298 {
299 ctk_list_store_insert_after (CTK_LIST_STORE (panel->priv->model)((((CtkListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->model)), ((ctk_list_store_get_type ()
))))))
,
300 &iter,
301 &sibling);
302 }
303 else
304 {
305 LapizTab *active_tab;
306
307 ctk_list_store_append (CTK_LIST_STORE (panel->priv->model)((((CtkListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->model)), ((ctk_list_store_get_type ()
))))))
,
308 &iter);
309
310 active_tab = lapiz_window_get_active_tab (panel->priv->window);
311
312 if (tab == active_tab)
313 {
314 CtkTreeSelection *selection;
315
316 selection = ctk_tree_view_get_selection (
317 CTK_TREE_VIEW (panel->priv->treeview)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->treeview)), ((ctk_tree_view_get_type (
)))))))
);
318
319 ctk_tree_selection_select_iter (selection, &iter);
320 }
321 }
322
323 name = tab_get_name (tab);
324 pixbuf = _lapiz_tab_get_icon (tab);
325
326 ctk_list_store_set (CTK_LIST_STORE (panel->priv->model)((((CtkListStore*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->model)), ((ctk_list_store_get_type ()
))))))
,
327 &iter,
328 PIXBUF_COLUMN, pixbuf,
329 NAME_COLUMN, name,
330 TAB_COLUMN, tab,
331 -1);
332
333 g_free (name);
334 if (pixbuf != NULL((void*)0))
335 g_object_unref (pixbuf);
336
337 panel->priv->adding_tab = FALSE(0);
338}
339
340static void
341window_tabs_reordered (LapizWindow *window G_GNUC_UNUSED__attribute__ ((__unused__)),
342 LapizDocumentsPanel *panel)
343{
344 if (panel->priv->is_reodering)
345 return;
346
347 refresh_list (panel);
348}
349
350static void
351set_window (LapizDocumentsPanel *panel,
352 LapizWindow *window)
353{
354 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)
;
355 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)
;
356
357 panel->priv->window = g_object_ref (window)((__typeof__ (window)) (g_object_ref) (window));
358
359 g_signal_connect (window,g_signal_connect_data ((window), ("tab_added"), (((GCallback)
(window_tab_added))), (panel), ((void*)0), (GConnectFlags) 0
)
360 "tab_added",g_signal_connect_data ((window), ("tab_added"), (((GCallback)
(window_tab_added))), (panel), ((void*)0), (GConnectFlags) 0
)
361 G_CALLBACK (window_tab_added),g_signal_connect_data ((window), ("tab_added"), (((GCallback)
(window_tab_added))), (panel), ((void*)0), (GConnectFlags) 0
)
362 panel)g_signal_connect_data ((window), ("tab_added"), (((GCallback)
(window_tab_added))), (panel), ((void*)0), (GConnectFlags) 0
)
;
363 g_signal_connect (window,g_signal_connect_data ((window), ("tab_removed"), (((GCallback
) (window_tab_removed))), (panel), ((void*)0), (GConnectFlags
) 0)
364 "tab_removed",g_signal_connect_data ((window), ("tab_removed"), (((GCallback
) (window_tab_removed))), (panel), ((void*)0), (GConnectFlags
) 0)
365 G_CALLBACK (window_tab_removed),g_signal_connect_data ((window), ("tab_removed"), (((GCallback
) (window_tab_removed))), (panel), ((void*)0), (GConnectFlags
) 0)
366 panel)g_signal_connect_data ((window), ("tab_removed"), (((GCallback
) (window_tab_removed))), (panel), ((void*)0), (GConnectFlags
) 0)
;
367 g_signal_connect (window,g_signal_connect_data ((window), ("tabs_reordered"), (((GCallback
) (window_tabs_reordered))), (panel), ((void*)0), (GConnectFlags
) 0)
368 "tabs_reordered",g_signal_connect_data ((window), ("tabs_reordered"), (((GCallback
) (window_tabs_reordered))), (panel), ((void*)0), (GConnectFlags
) 0)
369 G_CALLBACK (window_tabs_reordered),g_signal_connect_data ((window), ("tabs_reordered"), (((GCallback
) (window_tabs_reordered))), (panel), ((void*)0), (GConnectFlags
) 0)
370 panel)g_signal_connect_data ((window), ("tabs_reordered"), (((GCallback
) (window_tabs_reordered))), (panel), ((void*)0), (GConnectFlags
) 0)
;
371 g_signal_connect (window,g_signal_connect_data ((window), ("active_tab_changed"), (((GCallback
) (window_active_tab_changed))), (panel), ((void*)0), (GConnectFlags
) 0)
372 "active_tab_changed",g_signal_connect_data ((window), ("active_tab_changed"), (((GCallback
) (window_active_tab_changed))), (panel), ((void*)0), (GConnectFlags
) 0)
373 G_CALLBACK (window_active_tab_changed),g_signal_connect_data ((window), ("active_tab_changed"), (((GCallback
) (window_active_tab_changed))), (panel), ((void*)0), (GConnectFlags
) 0)
374 panel)g_signal_connect_data ((window), ("active_tab_changed"), (((GCallback
) (window_active_tab_changed))), (panel), ((void*)0), (GConnectFlags
) 0)
;
375}
376
377static void
378treeview_cursor_changed (CtkTreeView *view G_GNUC_UNUSED__attribute__ ((__unused__)),
379 LapizDocumentsPanel *panel)
380{
381 CtkTreeIter iter;
382 CtkTreeSelection *selection;
383 gpointer tab;
384
385 selection = ctk_tree_view_get_selection (
386 CTK_TREE_VIEW (panel->priv->treeview)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->treeview)), ((ctk_tree_view_get_type (
)))))))
);
387
388 if (ctk_tree_selection_get_selected (selection, NULL((void*)0), &iter))
389 {
390 ctk_tree_model_get (panel->priv->model,
391 &iter,
392 TAB_COLUMN,
393 &tab,
394 -1);
395
396 if (lapiz_window_get_active_tab (panel->priv->window) != tab)
397 {
398 lapiz_window_set_active_tab (panel->priv->window,
399 LAPIZ_TAB (tab)((((LapizTab*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tab)), ((lapiz_tab_get_type()))))))
);
400 }
401 }
402}
403
404static void
405lapiz_documents_panel_set_property (GObject *object,
406 guint prop_id,
407 const GValue *value,
408 GParamSpec *pspec)
409{
410 LapizDocumentsPanel *panel = LAPIZ_DOCUMENTS_PANEL (object)((((LapizDocumentsPanel*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((object)), ((lapiz_documents_panel_get_type
()))))))
;
411
412 switch (prop_id)
413 {
414 case PROP_WINDOW:
415 set_window (panel, g_value_get_object (value));
416 break;
417
418 default:
419 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-documents-panel.c", 419, ("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)
;
420 break;
421 }
422}
423
424static void
425lapiz_documents_panel_get_property (GObject *object,
426 guint prop_id,
427 GValue *value,
428 GParamSpec *pspec)
429{
430 LapizDocumentsPanel *panel = LAPIZ_DOCUMENTS_PANEL (object)((((LapizDocumentsPanel*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((object)), ((lapiz_documents_panel_get_type
()))))))
;
431
432 switch (prop_id)
433 {
434 case PROP_WINDOW:
435 panel->priv = lapiz_documents_panel_get_instance_private (panel);
436 g_value_set_object (value, panel->priv->window);
437 break;
438 default:
439 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-documents-panel.c", 439, ("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)
;
440 break;
441 }
442}
443
444static void
445lapiz_documents_panel_finalize (GObject *object)
446{
447 /* LapizDocumentsPanel *tab = LAPIZ_DOCUMENTS_PANEL (object); */
448
449 /* TODO: disconnect signal with window */
450
451 G_OBJECT_CLASS (lapiz_documents_panel_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((lapiz_documents_panel_parent_class)), (((GType) ((20) <<
(2))))))))
->finalize (object);
452}
453
454static void
455lapiz_documents_panel_dispose (GObject *object)
456{
457 LapizDocumentsPanel *panel = LAPIZ_DOCUMENTS_PANEL (object)((((LapizDocumentsPanel*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((object)), ((lapiz_documents_panel_get_type
()))))))
;
458
459 if (panel->priv->window != NULL((void*)0))
460 {
461 g_object_unref (panel->priv->window);
462 panel->priv->window = NULL((void*)0);
463 }
464
465 G_OBJECT_CLASS (lapiz_documents_panel_parent_class)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((lapiz_documents_panel_parent_class)), (((GType) ((20) <<
(2))))))))
->dispose (object);
466}
467
468static void
469lapiz_documents_panel_class_init (LapizDocumentsPanelClass *klass)
470{
471 GObjectClass *object_class = G_OBJECT_CLASS (klass)((((GObjectClass*) (void *) g_type_check_class_cast ((GTypeClass
*) ((klass)), (((GType) ((20) << (2))))))))
;
472
473 object_class->finalize = lapiz_documents_panel_finalize;
474 object_class->dispose = lapiz_documents_panel_dispose;
475 object_class->get_property = lapiz_documents_panel_get_property;
476 object_class->set_property = lapiz_documents_panel_set_property;
477
478 g_object_class_install_property (object_class,
479 PROP_WINDOW,
480 g_param_spec_object ("window",
481 "Window",
482 "The LapizWindow this LapizDocumentsPanel is associated with",
483 LAPIZ_TYPE_WINDOW(lapiz_window_get_type()),
484 G_PARAM_READWRITE |
485 G_PARAM_CONSTRUCT_ONLY |
486 G_PARAM_STATIC_STRINGS(G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB
)
));
487}
488
489static gboolean
490show_popup_menu (LapizDocumentsPanel *panel,
491 CdkEventButton *event)
492{
493 CtkWidget *menu;
494
495 menu = ctk_ui_manager_get_widget (lapiz_window_get_ui_manager (panel->priv->window),
496 "/NotebookPopup");
497 g_return_val_if_fail (menu != NULL, FALSE)do { if ((menu != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "menu != NULL"); return
((0)); } } while (0)
;
498
499 if (event != NULL((void*)0))
500 {
501 ctk_menu_popup_at_pointer (CTK_MENU (menu)((((CtkMenu*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_get_type ()))))))
, NULL((void*)0));
502 }
503 else
504 {
505 menu_popup_at_treeview_selection (menu, panel->priv->treeview);
506 ctk_menu_shell_select_first (CTK_MENU_SHELL (menu)((((CtkMenuShell*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((menu)), ((ctk_menu_shell_get_type ()))))))
, FALSE(0));
507 }
508
509 return TRUE(!(0));
510}
511
512static gboolean
513panel_button_press_event (CtkTreeView *treeview,
514 CdkEventButton *event,
515 LapizDocumentsPanel *panel)
516{
517 if ((CDK_BUTTON_PRESS == event->type) && (3 == event->button))
518 {
519 CtkTreePath* path = NULL((void*)0);
520
521 if (event->window == ctk_tree_view_get_bin_window (treeview))
522 {
523 /* Change the cursor position */
524 if (ctk_tree_view_get_path_at_pos (treeview,
525 event->x,
526 event->y,
527 &path,
528 NULL((void*)0),
529 NULL((void*)0),
530 NULL((void*)0)))
531 {
532
533 ctk_tree_view_set_cursor (treeview,
534 path,
535 NULL((void*)0),
536 FALSE(0));
537
538 ctk_tree_path_free (path);
539
540 /* A row exists at mouse position */
541 return show_popup_menu (panel, event);
542 }
543 }
544 }
545
546 return FALSE(0);
547}
548
549static gboolean
550panel_popup_menu (CtkWidget *treeview,
551 LapizDocumentsPanel *panel)
552{
553 /* Only respond if the treeview is the actual focus */
554 if (ctk_window_get_focus (CTK_WINDOW (panel->priv->window)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->window)), ((ctk_window_get_type ())))
)))
) == treeview)
555 {
556 return show_popup_menu (panel, NULL((void*)0));
557 }
558
559 return FALSE(0);
560}
561
562static gboolean
563treeview_query_tooltip (CtkWidget *widget,
564 gint x,
565 gint y,
566 gboolean keyboard_tip,
567 CtkTooltip *tooltip,
568 gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)))
569{
570 CtkTreeIter iter;
571 CtkTreeView *tree_view = CTK_TREE_VIEW (widget)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((widget)), ((ctk_tree_view_get_type ()))))))
;
572 CtkTreeModel *model = ctk_tree_view_get_model (tree_view);
573 CtkTreePath *path = NULL((void*)0);
574 gpointer *tab;
575 gchar *tip;
576
577 if (keyboard_tip)
578 {
579 ctk_tree_view_get_cursor (tree_view, &path, NULL((void*)0));
580
581 if (path == NULL((void*)0))
582 {
583 return FALSE(0);
584 }
585 }
586 else
587 {
588 gint bin_x, bin_y;
589
590 ctk_tree_view_convert_widget_to_bin_window_coords (tree_view,
591 x, y,
592 &bin_x, &bin_y);
593
594 if (!ctk_tree_view_get_path_at_pos (tree_view,
595 bin_x, bin_y,
596 &path,
597 NULL((void*)0), NULL((void*)0), NULL((void*)0)))
598 {
599 return FALSE(0);
600 }
601 }
602
603 ctk_tree_model_get_iter (model, &iter, path);
604 ctk_tree_model_get (model,
605 &iter,
606 TAB_COLUMN,
607 &tab,
608 -1);
609
610 tip = _lapiz_tab_get_tooltips (LAPIZ_TAB (tab)((((LapizTab*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tab)), ((lapiz_tab_get_type()))))))
);
Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption
611 ctk_tooltip_set_markup (tooltip, tip);
612
613 g_free (tip);
614 ctk_tree_path_free (path);
615
616 return TRUE(!(0));
617}
618
619static void
620treeview_row_inserted (CtkTreeModel *tree_model G_GNUC_UNUSED__attribute__ ((__unused__)),
621 CtkTreePath *path,
622 CtkTreeIter *iter G_GNUC_UNUSED__attribute__ ((__unused__)),
623 LapizDocumentsPanel *panel)
624{
625 LapizTab *tab;
626 gint *indeces;
627 CtkWidget *nb;
628 gint old_position;
629 gint new_position;
630
631 if (panel->priv->adding_tab)
632 return;
633
634 tab = lapiz_window_get_active_tab (panel->priv->window);
635 g_return_if_fail (tab != NULL)do { if ((tab != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "tab != NULL"); return
; } } while (0)
;
636
637 panel->priv->is_reodering = TRUE(!(0));
638
639 indeces = ctk_tree_path_get_indices (path);
640
641 /* g_debug ("New Index: %d (path: %s)", indeces[0], ctk_tree_path_to_string (path));*/
642
643 nb = _lapiz_window_get_notebook (panel->priv->window);
644
645 new_position = indeces[0];
646 old_position = ctk_notebook_page_num (CTK_NOTEBOOK (nb)((((CtkNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((nb)), ((ctk_notebook_get_type ()))))))
,
647 CTK_WIDGET (tab)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((tab)), ((ctk_widget_get_type ()))))))
);
648 if (new_position > old_position)
649 new_position = MAX (0, new_position - 1)(((0) > (new_position - 1)) ? (0) : (new_position - 1));
650
651 lapiz_notebook_reorder_tab (LAPIZ_NOTEBOOK (nb)((((LapizNotebook*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((nb)), ((lapiz_notebook_get_type ()))))))
,
652 tab,
653 new_position);
654
655 panel->priv->is_reodering = FALSE(0);
656}
657
658static void
659lapiz_documents_panel_init (LapizDocumentsPanel *panel)
660{
661 CtkWidget *sw;
662 CtkTreeViewColumn *column;
663 CtkCellRenderer *cell;
664 CtkTreeSelection *selection;
665
666 panel->priv = lapiz_documents_panel_get_instance_private (panel);
667
668 panel->priv->adding_tab = FALSE(0);
669 panel->priv->is_reodering = FALSE(0);
670
671 ctk_orientable_set_orientation (CTK_ORIENTABLE (panel)((((CtkOrientable*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel)), ((ctk_orientable_get_type ()))))))
,
672 CTK_ORIENTATION_VERTICAL);
673
674 /* Create the scrolled window */
675 sw = ctk_scrolled_window_new (NULL((void*)0), NULL((void*)0));
676 g_return_if_fail (sw != NULL)do { if ((sw != ((void*)0))) { } else { g_return_if_fail_warning
(((gchar*) 0), ((const char*) (__func__)), "sw != NULL"); return
; } } while (0)
;
677
678 ctk_scrolled_window_set_policy (CTK_SCROLLED_WINDOW (sw)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((sw)), ((ctk_scrolled_window_get_type ())))
)))
,
679 CTK_POLICY_AUTOMATIC,
680 CTK_POLICY_AUTOMATIC);
681 ctk_scrolled_window_set_shadow_type (CTK_SCROLLED_WINDOW (sw)((((CtkScrolledWindow*) (void *) g_type_check_instance_cast (
(GTypeInstance*) ((sw)), ((ctk_scrolled_window_get_type ())))
)))
,
682 CTK_SHADOW_IN);
683 ctk_widget_show (sw);
684 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);
685
686 /* Create the empty model */
687 panel->priv->model = CTK_TREE_MODEL (ctk_list_store_new (N_COLUMNS,((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_list_store_new (N_COLUMNS, (gdk_pixbuf_get_type ()),
((GType) ((16) << (2))), ((GType) ((17) << (2)))
))), ((ctk_tree_model_get_type ()))))))
688 GDK_TYPE_PIXBUF,((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_list_store_new (N_COLUMNS, (gdk_pixbuf_get_type ()),
((GType) ((16) << (2))), ((GType) ((17) << (2)))
))), ((ctk_tree_model_get_type ()))))))
689 G_TYPE_STRING,((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_list_store_new (N_COLUMNS, (gdk_pixbuf_get_type ()),
((GType) ((16) << (2))), ((GType) ((17) << (2)))
))), ((ctk_tree_model_get_type ()))))))
690 G_TYPE_POINTER))((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((ctk_list_store_new (N_COLUMNS, (gdk_pixbuf_get_type ()),
((GType) ((16) << (2))), ((GType) ((17) << (2)))
))), ((ctk_tree_model_get_type ()))))))
;
691
692 /* Create the treeview */
693 panel->priv->treeview = ctk_tree_view_new_with_model (panel->priv->model);
694 g_object_unref (G_OBJECT (panel->priv->model)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->model)), (((GType) ((20) << (2)
)))))))
);
695 ctk_container_add (CTK_CONTAINER (sw)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((sw)), ((ctk_container_get_type ()))))))
, panel->priv->treeview);
696 ctk_tree_view_set_headers_visible (CTK_TREE_VIEW (panel->priv->treeview)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->treeview)), ((ctk_tree_view_get_type (
)))))))
, FALSE(0));
697 ctk_tree_view_set_reorderable (CTK_TREE_VIEW (panel->priv->treeview)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->treeview)), ((ctk_tree_view_get_type (
)))))))
, TRUE(!(0)));
698
699 g_object_set (panel->priv->treeview, "has-tooltip", TRUE(!(0)), NULL((void*)0));
700
701 ctk_widget_show (panel->priv->treeview);
702
703 column = ctk_tree_view_column_new ();
704 ctk_tree_view_column_set_title (column, _("Documents")gettext ("Documents"));
705
706 cell = ctk_cell_renderer_pixbuf_new ();
707 ctk_tree_view_column_pack_start (column, cell, FALSE(0));
708 ctk_tree_view_column_add_attribute (column, cell, "pixbuf", PIXBUF_COLUMN);
709 cell = ctk_cell_renderer_text_new ();
710 ctk_tree_view_column_pack_start (column, cell, TRUE(!(0)));
711 ctk_tree_view_column_add_attribute (column, cell, "markup", NAME_COLUMN);
712
713 ctk_tree_view_append_column (CTK_TREE_VIEW (panel->priv->treeview)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->treeview)), ((ctk_tree_view_get_type (
)))))))
,
714 column);
715
716 selection = ctk_tree_view_get_selection (
717 CTK_TREE_VIEW (panel->priv->treeview)((((CtkTreeView*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((panel->priv->treeview)), ((ctk_tree_view_get_type (
)))))))
);
718
719 ctk_tree_selection_set_mode (selection, CTK_SELECTION_SINGLE);
720
721 g_signal_connect (panel->priv->treeview,g_signal_connect_data ((panel->priv->treeview), ("cursor_changed"
), (((GCallback) (treeview_cursor_changed))), (panel), ((void
*)0), (GConnectFlags) 0)
722 "cursor_changed",g_signal_connect_data ((panel->priv->treeview), ("cursor_changed"
), (((GCallback) (treeview_cursor_changed))), (panel), ((void
*)0), (GConnectFlags) 0)
723 G_CALLBACK (treeview_cursor_changed),g_signal_connect_data ((panel->priv->treeview), ("cursor_changed"
), (((GCallback) (treeview_cursor_changed))), (panel), ((void
*)0), (GConnectFlags) 0)
724 panel)g_signal_connect_data ((panel->priv->treeview), ("cursor_changed"
), (((GCallback) (treeview_cursor_changed))), (panel), ((void
*)0), (GConnectFlags) 0)
;
725 g_signal_connect (panel->priv->treeview,g_signal_connect_data ((panel->priv->treeview), ("button-press-event"
), (((GCallback) (panel_button_press_event))), (panel), ((void
*)0), (GConnectFlags) 0)
726 "button-press-event",g_signal_connect_data ((panel->priv->treeview), ("button-press-event"
), (((GCallback) (panel_button_press_event))), (panel), ((void
*)0), (GConnectFlags) 0)
727 G_CALLBACK (panel_button_press_event),g_signal_connect_data ((panel->priv->treeview), ("button-press-event"
), (((GCallback) (panel_button_press_event))), (panel), ((void
*)0), (GConnectFlags) 0)
728 panel)g_signal_connect_data ((panel->priv->treeview), ("button-press-event"
), (((GCallback) (panel_button_press_event))), (panel), ((void
*)0), (GConnectFlags) 0)
;
729 g_signal_connect (panel->priv->treeview,g_signal_connect_data ((panel->priv->treeview), ("popup-menu"
), (((GCallback) (panel_popup_menu))), (panel), ((void*)0), (
GConnectFlags) 0)
730 "popup-menu",g_signal_connect_data ((panel->priv->treeview), ("popup-menu"
), (((GCallback) (panel_popup_menu))), (panel), ((void*)0), (
GConnectFlags) 0)
731 G_CALLBACK (panel_popup_menu),g_signal_connect_data ((panel->priv->treeview), ("popup-menu"
), (((GCallback) (panel_popup_menu))), (panel), ((void*)0), (
GConnectFlags) 0)
732 panel)g_signal_connect_data ((panel->priv->treeview), ("popup-menu"
), (((GCallback) (panel_popup_menu))), (panel), ((void*)0), (
GConnectFlags) 0)
;
733 g_signal_connect (panel->priv->treeview,g_signal_connect_data ((panel->priv->treeview), ("query-tooltip"
), (((GCallback) (treeview_query_tooltip))), (((void*)0)), ((
void*)0), (GConnectFlags) 0)
734 "query-tooltip",g_signal_connect_data ((panel->priv->treeview), ("query-tooltip"
), (((GCallback) (treeview_query_tooltip))), (((void*)0)), ((
void*)0), (GConnectFlags) 0)
735 G_CALLBACK (treeview_query_tooltip),g_signal_connect_data ((panel->priv->treeview), ("query-tooltip"
), (((GCallback) (treeview_query_tooltip))), (((void*)0)), ((
void*)0), (GConnectFlags) 0)
736 NULL)g_signal_connect_data ((panel->priv->treeview), ("query-tooltip"
), (((GCallback) (treeview_query_tooltip))), (((void*)0)), ((
void*)0), (GConnectFlags) 0)
;
737
738 g_signal_connect (panel->priv->model,g_signal_connect_data ((panel->priv->model), ("row-inserted"
), (((GCallback) (treeview_row_inserted))), (panel), ((void*)
0), (GConnectFlags) 0)
739 "row-inserted",g_signal_connect_data ((panel->priv->model), ("row-inserted"
), (((GCallback) (treeview_row_inserted))), (panel), ((void*)
0), (GConnectFlags) 0)
740 G_CALLBACK (treeview_row_inserted),g_signal_connect_data ((panel->priv->model), ("row-inserted"
), (((GCallback) (treeview_row_inserted))), (panel), ((void*)
0), (GConnectFlags) 0)
741 panel)g_signal_connect_data ((panel->priv->model), ("row-inserted"
), (((GCallback) (treeview_row_inserted))), (panel), ((void*)
0), (GConnectFlags) 0)
;
742}
743
744CtkWidget *
745lapiz_documents_panel_new (LapizWindow *window)
746{
747 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)
;
748
749 return CTK_WIDGET (g_object_new (LAPIZ_TYPE_DOCUMENTS_PANEL,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((lapiz_documents_panel_get_type()), "window"
, window, ((void*)0)))), ((ctk_widget_get_type ()))))))
750 "window", window,((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((lapiz_documents_panel_get_type()), "window"
, window, ((void*)0)))), ((ctk_widget_get_type ()))))))
751 NULL))((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((g_object_new ((lapiz_documents_panel_get_type()), "window"
, window, ((void*)0)))), ((ctk_widget_get_type ()))))))
;
752}