~ubuntu-branches/debian/sid/link-monitor-applet/sid

« back to all changes in this revision

Viewing changes to build/src/lm-host-view.c

  • Committer: Bazaar Package Importer
  • Author(s): Adriaan Peeters
  • Date: 2008-03-30 22:26:13 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20080330222613-5aubcuo9mgg2n7st
Tags: upstream-3.0
ImportĀ upstreamĀ versionĀ 3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Generated by GOB (v2.0.15)   (do not edit directly) */
 
2
 
 
3
/* End world hunger, donate to the World Food Programme, http://www.wfp.org */
 
4
 
 
5
#define GOB_VERSION_MAJOR 2
 
6
#define GOB_VERSION_MINOR 0
 
7
#define GOB_VERSION_PATCHLEVEL 15
 
8
 
 
9
#define selfp (self->_priv)
 
10
 
 
11
#include <string.h> /* memset() */
 
12
 
 
13
#include "lm-host-view.h"
 
14
 
 
15
#include "lm-host-view-private.h"
 
16
 
 
17
#ifdef G_LIKELY
 
18
#define ___GOB_LIKELY(expr) G_LIKELY(expr)
 
19
#define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
 
20
#else /* ! G_LIKELY */
 
21
#define ___GOB_LIKELY(expr) (expr)
 
22
#define ___GOB_UNLIKELY(expr) (expr)
 
23
#endif /* G_LIKELY */
 
24
 
 
25
#line 25 "src/lm-host-view.gob"
 
26
 
 
27
#include <glib/gi18n.h>
 
28
#include "lm-cell-renderer-color.h"
 
29
#include "lm-host-frontend.h"
 
30
#include "lm-util.h"
 
31
 
 
32
enum {
 
33
  COLUMN_HOST,
 
34
  COLUMN_COLOR,
 
35
  COLUMN_NAME,
 
36
  N_COLUMNS
 
37
};
 
38
 
 
39
typedef enum {
 
40
  CLIPBOARD_TARGET_NATIVE,
 
41
  CLIPBOARD_TARGET_TEXT
 
42
} ClipboardTarget;
 
43
 
 
44
#define CLIPBOARD_TARGET_NATIVE_NAME    "x-special/link-monitor-applet-hosts"
 
45
 
 
46
static GdkAtom clipboard_target_native_atom;
 
47
 
 
48
static GtkClipboard *global_clipboard;
 
49
 
 
50
#line 51 "lm-host-view.c"
 
51
/* self casting macros */
 
52
#define SELF(x) LM_HOST_VIEW(x)
 
53
#define SELF_CONST(x) LM_HOST_VIEW_CONST(x)
 
54
#define IS_SELF(x) LM_IS_HOST_VIEW(x)
 
55
#define TYPE_SELF LM_TYPE_HOST_VIEW
 
56
#define SELF_CLASS(x) LM_HOST_VIEW_CLASS(x)
 
57
 
 
58
#define SELF_GET_CLASS(x) LM_HOST_VIEW_GET_CLASS(x)
 
59
 
 
60
/* self typedefs */
 
61
typedef LMHostView Self;
 
62
typedef LMHostViewClass SelfClass;
 
63
 
 
64
/* here are local prototypes */
 
65
static void ___object_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
 
66
static void ___object_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 
67
#line 0 "src/lm-host-view.gob"
 
68
static void lm_host_view_init (LMHostView * o);
 
69
#line 70 "lm-host-view.c"
 
70
#line 79 "src/lm-host-view.gob"
 
71
static void lm_host_view_class_init (LMHostViewClass * class);
 
72
#line 73 "lm-host-view.c"
 
73
#line 104 "src/lm-host-view.gob"
 
74
static void lm_host_view_constructor (LMHostView * self);
 
75
#line 76 "lm-host-view.c"
 
76
#line 207 "src/lm-host-view.gob"
 
77
static GSList * lm_host_view_get_selected_rows (LMHostView * self);
 
78
#line 79 "lm-host-view.c"
 
79
#line 232 "src/lm-host-view.gob"
 
80
static void lm_host_view_store_remove (LMHostView * self, GtkListStore * store, GtkTreeIter * iter);
 
81
#line 82 "lm-host-view.c"
 
82
#line 243 "src/lm-host-view.gob"
 
83
static void lm_host_view_reorder (LMHostView * self);
 
84
#line 85 "lm-host-view.c"
 
85
static void ___real_lm_host_view_activate_add (LMHostView * self);
 
86
static void ___real_lm_host_view_activate_move (LMHostView * self, int direction);
 
87
static void ___real_lm_host_view_activate_remove (LMHostView * self);
 
88
#line 349 "src/lm-host-view.gob"
 
89
static void lm_host_view_remove_selected_hosts (LMHostView * self);
 
90
#line 91 "lm-host-view.c"
 
91
#line 385 "src/lm-host-view.gob"
 
92
static void lm_host_view_copy_selected_hosts (LMHostView * self);
 
93
#line 94 "lm-host-view.c"
 
94
#line 440 "src/lm-host-view.gob"
 
95
static void lm_host_view_get_clipboard_cb (GtkClipboard * clipboard, GtkSelectionData * selection_data, unsigned int info, gpointer user_data_or_owner);
 
96
#line 97 "lm-host-view.c"
 
97
#line 486 "src/lm-host-view.gob"
 
98
static void lm_host_view_clear_clipboard_cb (GtkClipboard * clipboard, gpointer user_data_or_owner);
 
99
#line 100 "lm-host-view.c"
 
100
static void ___real_lm_host_view_activate_cut (LMHostView * self);
 
101
#line 494 "src/lm-host-view.gob"
 
102
static void lm_host_view_activate_cut (LMHostView * self);
 
103
#line 104 "lm-host-view.c"
 
104
static void ___real_lm_host_view_activate_copy (LMHostView * self);
 
105
#line 501 "src/lm-host-view.gob"
 
106
static void lm_host_view_activate_copy (LMHostView * self);
 
107
#line 108 "lm-host-view.c"
 
108
static void ___real_lm_host_view_activate_paste (LMHostView * self);
 
109
#line 507 "src/lm-host-view.gob"
 
110
static void lm_host_view_activate_paste (LMHostView * self);
 
111
#line 112 "lm-host-view.c"
 
112
#line 557 "src/lm-host-view.gob"
 
113
static void lm_host_view_add_host (LMHostView * self, LMHostFrontend * host);
 
114
#line 115 "lm-host-view.c"
 
115
#line 575 "src/lm-host-view.gob"
 
116
static void lm_host_view_selection_changed_h (GtkTreeSelection * selection, gpointer user_data);
 
117
#line 118 "lm-host-view.c"
 
118
#line 584 "src/lm-host-view.gob"
 
119
static void lm_host_view_color_activated_h (LMCellRendererColor * renderer, const char * path, gpointer user_data);
 
120
#line 121 "lm-host-view.c"
 
121
#line 629 "src/lm-host-view.gob"
 
122
static void lm_host_view_color_dialog_response_h (GtkDialog * dialog, int response, gpointer user_data);
 
123
#line 124 "lm-host-view.c"
 
124
#line 663 "src/lm-host-view.gob"
 
125
static void lm_host_view_color_dialog_weak_notify_cb (gpointer data, GObject * former_dialog);
 
126
#line 127 "lm-host-view.c"
 
127
#line 674 "src/lm-host-view.gob"
 
128
static void lm_host_view_editing_started_h (GtkCellRenderer * renderer, GtkCellEditable * editable, char * path, gpointer user_data);
 
129
#line 130 "lm-host-view.c"
 
130
#line 685 "src/lm-host-view.gob"
 
131
static void lm_host_view_editing_canceled_h (GtkCellRenderer * renderer, gpointer user_data);
 
132
#line 133 "lm-host-view.c"
 
133
#line 703 "src/lm-host-view.gob"
 
134
static void lm_host_view_edited_h (GtkCellRendererText * renderer, const char * path_string, const char * new_text, gpointer user_data);
 
135
#line 136 "lm-host-view.c"
 
136
#line 748 "src/lm-host-view.gob"
 
137
static void lm_host_view_update_sensitivity (LMHostView * self);
 
138
#line 139 "lm-host-view.c"
 
139
#line 808 "src/lm-host-view.gob"
 
140
static void lm_host_view_popup_menu (LMHostView * self, int button, guint32 activate_time);
 
141
#line 142 "lm-host-view.c"
 
142
#line 825 "src/lm-host-view.gob"
 
143
static void lm_host_view_popup_menu_targets_received_cb (GtkClipboard * clipboard, GdkAtom * atoms, int n_atoms, gpointer data);
 
144
#line 145 "lm-host-view.c"
 
145
#line 845 "src/lm-host-view.gob"
 
146
static gboolean lm_host_view_can_paste (GdkAtom * atoms, int n_atoms);
 
147
#line 148 "lm-host-view.c"
 
148
#line 857 "src/lm-host-view.gob"
 
149
static gboolean lm_host_view_popup_menu_h (GtkWidget * widget, gpointer user_data);
 
150
#line 151 "lm-host-view.c"
 
151
#line 868 "src/lm-host-view.gob"
 
152
static gboolean lm_host_view_button_press_event_h (GtkWidget * widget, GdkEventButton * event, gpointer user_data);
 
153
#line 154 "lm-host-view.c"
 
154
#line 879 "src/lm-host-view.gob"
 
155
static void lm_host_view_select_all_activate_h (GtkMenuItem * item, gpointer user_data);
 
156
#line 157 "lm-host-view.c"
 
157
#line 889 "src/lm-host-view.gob"
 
158
static void lm_host_view_up_activate_h (GtkMenuItem * item, gpointer user_data);
 
159
#line 160 "lm-host-view.c"
 
160
#line 896 "src/lm-host-view.gob"
 
161
static void lm_host_view_down_activate_h (GtkMenuItem * item, gpointer user_data);
 
162
#line 163 "lm-host-view.c"
 
163
#line 903 "src/lm-host-view.gob"
 
164
static gboolean lm_host_view_search_equal_cb (GtkTreeModel * model, int column, const char * key, GtkTreeIter * iter, gpointer search_data);
 
165
#line 166 "lm-host-view.c"
 
166
 
 
167
/*
 
168
 * Signal connection wrapper macro shortcuts
 
169
 */
 
170
#define self_connect__activate_add(object,func,data)    lm_host_view_connect__activate_add((object),(func),(data))
 
171
#define self_connect_after__activate_add(object,func,data)      lm_host_view_connect_after__activate_add((object),(func),(data))
 
172
#define self_connect_data__activate_add(object,func,data,destroy_data,flags)    lm_host_view_connect_data__activate_add((object),(func),(data),(destroy_data),(flags))
 
173
#define self_connect__activate_move(object,func,data)   lm_host_view_connect__activate_move((object),(func),(data))
 
174
#define self_connect_after__activate_move(object,func,data)     lm_host_view_connect_after__activate_move((object),(func),(data))
 
175
#define self_connect_data__activate_move(object,func,data,destroy_data,flags)   lm_host_view_connect_data__activate_move((object),(func),(data),(destroy_data),(flags))
 
176
#define self_connect__activate_remove(object,func,data) lm_host_view_connect__activate_remove((object),(func),(data))
 
177
#define self_connect_after__activate_remove(object,func,data)   lm_host_view_connect_after__activate_remove((object),(func),(data))
 
178
#define self_connect_data__activate_remove(object,func,data,destroy_data,flags) lm_host_view_connect_data__activate_remove((object),(func),(data),(destroy_data),(flags))
 
179
#define self_connect__activate_cut(object,func,data)    lm_host_view_connect__activate_cut((object),(func),(data))
 
180
#define self_connect_after__activate_cut(object,func,data)      lm_host_view_connect_after__activate_cut((object),(func),(data))
 
181
#define self_connect_data__activate_cut(object,func,data,destroy_data,flags)    lm_host_view_connect_data__activate_cut((object),(func),(data),(destroy_data),(flags))
 
182
#define self_connect__activate_copy(object,func,data)   lm_host_view_connect__activate_copy((object),(func),(data))
 
183
#define self_connect_after__activate_copy(object,func,data)     lm_host_view_connect_after__activate_copy((object),(func),(data))
 
184
#define self_connect_data__activate_copy(object,func,data,destroy_data,flags)   lm_host_view_connect_data__activate_copy((object),(func),(data),(destroy_data),(flags))
 
185
#define self_connect__activate_paste(object,func,data)  lm_host_view_connect__activate_paste((object),(func),(data))
 
186
#define self_connect_after__activate_paste(object,func,data)    lm_host_view_connect_after__activate_paste((object),(func),(data))
 
187
#define self_connect_data__activate_paste(object,func,data,destroy_data,flags)  lm_host_view_connect_data__activate_paste((object),(func),(data),(destroy_data),(flags))
 
188
 
 
189
typedef void  (*___Sig1) (LMHostView *, gint , gpointer);
 
190
 
 
191
static void
 
192
___marshal_Sig1 (GClosure *closure,
 
193
        GValue *return_value G_GNUC_UNUSED,
 
194
        guint n_param_values,
 
195
        const GValue *param_values,
 
196
        gpointer invocation_hint G_GNUC_UNUSED,
 
197
        gpointer marshal_data)
 
198
{
 
199
        register ___Sig1 callback;
 
200
        register GCClosure *cc = (GCClosure*) closure;
 
201
        register gpointer data1, data2;
 
202
 
 
203
        g_return_if_fail (n_param_values == 2);
 
204
 
 
205
        if (G_CCLOSURE_SWAP_DATA (closure)) {
 
206
                data1 = closure->data;
 
207
                data2 = g_value_peek_pointer (param_values + 0);
 
208
        } else {
 
209
                data1 = g_value_peek_pointer (param_values + 0);
 
210
                data2 = closure->data;
 
211
        }
 
212
 
 
213
        callback = (___Sig1) (marshal_data != NULL ? marshal_data : cc->callback);
 
214
 
 
215
        callback ((LMHostView *)data1,
 
216
                (gint ) g_value_get_int (param_values + 1),
 
217
                data2);
 
218
}
 
219
 
 
220
 
 
221
enum {
 
222
        ACTIVATE_ADD_SIGNAL,
 
223
        ACTIVATE_MOVE_SIGNAL,
 
224
        ACTIVATE_REMOVE_SIGNAL,
 
225
        ACTIVATE_CUT_SIGNAL,
 
226
        ACTIVATE_COPY_SIGNAL,
 
227
        ACTIVATE_PASTE_SIGNAL,
 
228
        LAST_SIGNAL
 
229
};
 
230
 
 
231
enum {
 
232
        PROP_0,
 
233
        PROP_APPLET,
 
234
        PROP_EDITING_HOST,
 
235
        PROP_CAN_GO_UP,
 
236
        PROP_CAN_GO_DOWN
 
237
};
 
238
 
 
239
static guint object_signals[LAST_SIGNAL] = {0};
 
240
 
 
241
/* pointer to the class of our parent */
 
242
static GtkTreeViewClass *parent_class = NULL;
 
243
 
 
244
/* Short form macros */
 
245
#define self_get_editing_host lm_host_view_get_editing_host
 
246
#define self_set_editing_host lm_host_view_set_editing_host
 
247
#define self_get_can_go_up lm_host_view_get_can_go_up
 
248
#define self_set_can_go_up lm_host_view_set_can_go_up
 
249
#define self_get_can_go_down lm_host_view_get_can_go_down
 
250
#define self_set_can_go_down lm_host_view_set_can_go_down
 
251
#define self_get_selected_rows lm_host_view_get_selected_rows
 
252
#define self_store_remove lm_host_view_store_remove
 
253
#define self_reorder lm_host_view_reorder
 
254
#define self_activate_add lm_host_view_activate_add
 
255
#define self_activate_move lm_host_view_activate_move
 
256
#define self_activate_remove lm_host_view_activate_remove
 
257
#define self_remove_selected_hosts lm_host_view_remove_selected_hosts
 
258
#define self_copy_selected_hosts lm_host_view_copy_selected_hosts
 
259
#define self_get_clipboard_cb lm_host_view_get_clipboard_cb
 
260
#define self_clear_clipboard_cb lm_host_view_clear_clipboard_cb
 
261
#define self_activate_cut lm_host_view_activate_cut
 
262
#define self_activate_copy lm_host_view_activate_copy
 
263
#define self_activate_paste lm_host_view_activate_paste
 
264
#define self_add_host lm_host_view_add_host
 
265
#define self_selection_changed_h lm_host_view_selection_changed_h
 
266
#define self_color_activated_h lm_host_view_color_activated_h
 
267
#define self_color_dialog_response_h lm_host_view_color_dialog_response_h
 
268
#define self_color_dialog_weak_notify_cb lm_host_view_color_dialog_weak_notify_cb
 
269
#define self_editing_started_h lm_host_view_editing_started_h
 
270
#define self_editing_canceled_h lm_host_view_editing_canceled_h
 
271
#define self_edited_h lm_host_view_edited_h
 
272
#define self_update_sensitivity lm_host_view_update_sensitivity
 
273
#define self_popup_menu lm_host_view_popup_menu
 
274
#define self_popup_menu_targets_received_cb lm_host_view_popup_menu_targets_received_cb
 
275
#define self_can_paste lm_host_view_can_paste
 
276
#define self_popup_menu_h lm_host_view_popup_menu_h
 
277
#define self_button_press_event_h lm_host_view_button_press_event_h
 
278
#define self_select_all_activate_h lm_host_view_select_all_activate_h
 
279
#define self_up_activate_h lm_host_view_up_activate_h
 
280
#define self_down_activate_h lm_host_view_down_activate_h
 
281
#define self_search_equal_cb lm_host_view_search_equal_cb
 
282
#define self_new lm_host_view_new
 
283
GType
 
284
lm_host_view_get_type (void)
 
285
{
 
286
        static GType type = 0;
 
287
 
 
288
        if ___GOB_UNLIKELY(type == 0) {
 
289
                static const GTypeInfo info = {
 
290
                        sizeof (LMHostViewClass),
 
291
                        (GBaseInitFunc) NULL,
 
292
                        (GBaseFinalizeFunc) NULL,
 
293
                        (GClassInitFunc) lm_host_view_class_init,
 
294
                        (GClassFinalizeFunc) NULL,
 
295
                        NULL /* class_data */,
 
296
                        sizeof (LMHostView),
 
297
                        0 /* n_preallocs */,
 
298
                        (GInstanceInitFunc) lm_host_view_init,
 
299
                        NULL
 
300
                };
 
301
 
 
302
                type = g_type_register_static (GTK_TYPE_TREE_VIEW, "LMHostView", &info, (GTypeFlags)0);
 
303
        }
 
304
 
 
305
        return type;
 
306
}
 
307
 
 
308
/* a macro for creating a new object of our type */
 
309
#define GET_NEW ((LMHostView *)g_object_new(lm_host_view_get_type(), NULL))
 
310
 
 
311
/* a function for creating a new object of our type */
 
312
#include <stdarg.h>
 
313
static LMHostView * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
 
314
static LMHostView *
 
315
GET_NEW_VARG (const char *first, ...)
 
316
{
 
317
        LMHostView *ret;
 
318
        va_list ap;
 
319
        va_start (ap, first);
 
320
        ret = (LMHostView *)g_object_new_valist (lm_host_view_get_type (), first, ap);
 
321
        va_end (ap);
 
322
        return ret;
 
323
}
 
324
 
 
325
 
 
326
static GObject *
 
327
___constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties)
 
328
{
 
329
#define __GOB_FUNCTION__ "LM:Host:View::constructor"
 
330
        GObject *obj_self;
 
331
        LMHostView *self;
 
332
        obj_self = G_OBJECT_CLASS (parent_class)->constructor (type, n_construct_properties, construct_properties);
 
333
        self = LM_HOST_VIEW (obj_self);
 
334
#line 104 "src/lm-host-view.gob"
 
335
        lm_host_view_constructor (self);
 
336
#line 337 "lm-host-view.c"
 
337
        return obj_self;
 
338
}
 
339
#undef __GOB_FUNCTION__
 
340
 
 
341
 
 
342
static void
 
343
___finalize(GObject *obj_self)
 
344
{
 
345
#define __GOB_FUNCTION__ "LM:Host:View::finalize"
 
346
        LMHostView *self G_GNUC_UNUSED = LM_HOST_VIEW (obj_self);
 
347
        gpointer priv G_GNUC_UNUSED = self->_priv;
 
348
        if(G_OBJECT_CLASS(parent_class)->finalize) \
 
349
                (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
 
350
#line 55 "src/lm-host-view.gob"
 
351
        if(self->_priv->menu) { gtk_widget_destroy ((gpointer) self->_priv->menu); self->_priv->menu = NULL; }
 
352
#line 353 "lm-host-view.c"
 
353
#line 76 "src/lm-host-view.gob"
 
354
        if(self->_priv->color_dialog) { gtk_widget_destroy ((gpointer) self->_priv->color_dialog); self->_priv->color_dialog = NULL; }
 
355
#line 356 "lm-host-view.c"
 
356
}
 
357
#undef __GOB_FUNCTION__
 
358
 
 
359
static void 
 
360
lm_host_view_init (LMHostView * o G_GNUC_UNUSED)
 
361
{
 
362
#define __GOB_FUNCTION__ "LM:Host:View::init"
 
363
        o->_priv = G_TYPE_INSTANCE_GET_PRIVATE(o,LM_TYPE_HOST_VIEW,LMHostViewPrivate);
 
364
#line 55 "src/lm-host-view.gob"
 
365
        o->_priv->menu = gtk_menu_new();
 
366
#line 367 "lm-host-view.c"
 
367
}
 
368
#undef __GOB_FUNCTION__
 
369
#line 79 "src/lm-host-view.gob"
 
370
static void 
 
371
lm_host_view_class_init (LMHostViewClass * class G_GNUC_UNUSED)
 
372
{
 
373
#line 374 "lm-host-view.c"
 
374
#define __GOB_FUNCTION__ "LM:Host:View::class_init"
 
375
        GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) class;
 
376
 
 
377
        g_type_class_add_private(class,sizeof(LMHostViewPrivate));
 
378
 
 
379
        parent_class = g_type_class_ref (GTK_TYPE_TREE_VIEW);
 
380
 
 
381
        object_signals[ACTIVATE_ADD_SIGNAL] =
 
382
                g_signal_new ("activate_add",
 
383
                        G_TYPE_FROM_CLASS (g_object_class),
 
384
                        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION | G_SIGNAL_ACTION),
 
385
                        G_STRUCT_OFFSET (LMHostViewClass, activate_add),
 
386
                        NULL, NULL,
 
387
                        g_cclosure_marshal_VOID__VOID,
 
388
                        G_TYPE_NONE, 0);
 
389
        object_signals[ACTIVATE_MOVE_SIGNAL] =
 
390
                g_signal_new ("activate_move",
 
391
                        G_TYPE_FROM_CLASS (g_object_class),
 
392
                        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION | G_SIGNAL_ACTION),
 
393
                        G_STRUCT_OFFSET (LMHostViewClass, activate_move),
 
394
                        NULL, NULL,
 
395
                        ___marshal_Sig1,
 
396
                        G_TYPE_NONE, 1,
 
397
                        G_TYPE_INT);
 
398
        if ___GOB_UNLIKELY(sizeof(int ) != sizeof(gint ) || parent_class == NULL /* avoid warning */) {
 
399
                g_error("src/lm-host-view.gob line 288: Type mismatch of \"activate_move\" signal signature");
 
400
        }
 
401
        object_signals[ACTIVATE_REMOVE_SIGNAL] =
 
402
                g_signal_new ("activate_remove",
 
403
                        G_TYPE_FROM_CLASS (g_object_class),
 
404
                        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION | G_SIGNAL_ACTION),
 
405
                        G_STRUCT_OFFSET (LMHostViewClass, activate_remove),
 
406
                        NULL, NULL,
 
407
                        g_cclosure_marshal_VOID__VOID,
 
408
                        G_TYPE_NONE, 0);
 
409
        object_signals[ACTIVATE_CUT_SIGNAL] =
 
410
                g_signal_new ("activate_cut",
 
411
                        G_TYPE_FROM_CLASS (g_object_class),
 
412
                        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 
413
                        G_STRUCT_OFFSET (LMHostViewClass, activate_cut),
 
414
                        NULL, NULL,
 
415
                        g_cclosure_marshal_VOID__VOID,
 
416
                        G_TYPE_NONE, 0);
 
417
        object_signals[ACTIVATE_COPY_SIGNAL] =
 
418
                g_signal_new ("activate_copy",
 
419
                        G_TYPE_FROM_CLASS (g_object_class),
 
420
                        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 
421
                        G_STRUCT_OFFSET (LMHostViewClass, activate_copy),
 
422
                        NULL, NULL,
 
423
                        g_cclosure_marshal_VOID__VOID,
 
424
                        G_TYPE_NONE, 0);
 
425
        object_signals[ACTIVATE_PASTE_SIGNAL] =
 
426
                g_signal_new ("activate_paste",
 
427
                        G_TYPE_FROM_CLASS (g_object_class),
 
428
                        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
 
429
                        G_STRUCT_OFFSET (LMHostViewClass, activate_paste),
 
430
                        NULL, NULL,
 
431
                        g_cclosure_marshal_VOID__VOID,
 
432
                        G_TYPE_NONE, 0);
 
433
 
 
434
#line 268 "src/lm-host-view.gob"
 
435
        class->activate_add = ___real_lm_host_view_activate_add;
 
436
#line 288 "src/lm-host-view.gob"
 
437
        class->activate_move = ___real_lm_host_view_activate_move;
 
438
#line 343 "src/lm-host-view.gob"
 
439
        class->activate_remove = ___real_lm_host_view_activate_remove;
 
440
#line 494 "src/lm-host-view.gob"
 
441
        class->activate_cut = ___real_lm_host_view_activate_cut;
 
442
#line 501 "src/lm-host-view.gob"
 
443
        class->activate_copy = ___real_lm_host_view_activate_copy;
 
444
#line 507 "src/lm-host-view.gob"
 
445
        class->activate_paste = ___real_lm_host_view_activate_paste;
 
446
#line 447 "lm-host-view.c"
 
447
        g_object_class->constructor = ___constructor;
 
448
        g_object_class->finalize = ___finalize;
 
449
        g_object_class->get_property = ___object_get_property;
 
450
        g_object_class->set_property = ___object_set_property;
 
451
    {
 
452
        GParamSpec   *param_spec;
 
453
 
 
454
        param_spec = g_param_spec_pointer
 
455
                ("applet" /* name */,
 
456
                 NULL /* nick */,
 
457
                 NULL /* blurb */,
 
458
                 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
 
459
        g_object_class_install_property (g_object_class,
 
460
                PROP_APPLET,
 
461
                param_spec);
 
462
        param_spec = g_param_spec_boolean
 
463
                ("editing_host" /* name */,
 
464
                 NULL /* nick */,
 
465
                 NULL /* blurb */,
 
466
                 FALSE /* default_value */,
 
467
                 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
 
468
        g_object_class_install_property (g_object_class,
 
469
                PROP_EDITING_HOST,
 
470
                param_spec);
 
471
        param_spec = g_param_spec_boolean
 
472
                ("can_go_up" /* name */,
 
473
                 NULL /* nick */,
 
474
                 NULL /* blurb */,
 
475
                 FALSE /* default_value */,
 
476
                 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
 
477
        g_object_class_install_property (g_object_class,
 
478
                PROP_CAN_GO_UP,
 
479
                param_spec);
 
480
        param_spec = g_param_spec_boolean
 
481
                ("can_go_down" /* name */,
 
482
                 NULL /* nick */,
 
483
                 NULL /* blurb */,
 
484
                 FALSE /* default_value */,
 
485
                 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
 
486
        g_object_class_install_property (g_object_class,
 
487
                PROP_CAN_GO_DOWN,
 
488
                param_spec);
 
489
    }
 
490
 {
 
491
#line 80 "src/lm-host-view.gob"
 
492
 
 
493
    GtkBindingSet *binding_set;
 
494
 
 
495
    global_clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
 
496
 
 
497
    clipboard_target_native_atom = gdk_atom_intern(CLIPBOARD_TARGET_NATIVE_NAME, FALSE);
 
498
 
 
499
    binding_set = gtk_binding_set_by_class(class);
 
500
 
 
501
    /* Delete removes a row */
 
502
    gtk_binding_entry_add_signal(binding_set, GDK_Delete, 0, "activate-remove", 0);
 
503
    gtk_binding_entry_add_signal(binding_set, GDK_KP_Delete, 0, "activate-remove", 0);
 
504
 
 
505
    /* HIG 2.0 cut/copy/paste shortcuts */
 
506
    gtk_binding_entry_add_signal(binding_set, GDK_x, GDK_CONTROL_MASK, "activate-cut", 0);
 
507
    gtk_binding_entry_add_signal(binding_set, GDK_c, GDK_CONTROL_MASK, "activate-copy", 0);
 
508
    gtk_binding_entry_add_signal(binding_set, GDK_v, GDK_CONTROL_MASK, "activate-paste", 0);
 
509
 
 
510
    /* cut/copy/paste shortcuts taken from gtkentry.c */
 
511
    gtk_binding_entry_add_signal(binding_set, GDK_Delete, GDK_SHIFT_MASK, "activate-cut", 0);
 
512
    gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_CONTROL_MASK, "activate-copy", 0);
 
513
    gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_SHIFT_MASK, "activate-paste", 0);
 
514
  
 
515
#line 516 "lm-host-view.c"
 
516
 }
 
517
}
 
518
#undef __GOB_FUNCTION__
 
519
 
 
520
static void
 
521
___object_set_property (GObject *object,
 
522
        guint property_id,
 
523
        const GValue *VAL G_GNUC_UNUSED,
 
524
        GParamSpec *pspec G_GNUC_UNUSED)
 
525
#define __GOB_FUNCTION__ "LM:Host:View::set_property"
 
526
{
 
527
        LMHostView *self G_GNUC_UNUSED;
 
528
 
 
529
        self = LM_HOST_VIEW (object);
 
530
 
 
531
        switch (property_id) {
 
532
        case PROP_APPLET:
 
533
                {
 
534
#line 53 "src/lm-host-view.gob"
 
535
self->_priv->applet = g_value_get_pointer (VAL);
 
536
#line 537 "lm-host-view.c"
 
537
                }
 
538
                break;
 
539
        case PROP_EDITING_HOST:
 
540
                {
 
541
#line 68 "src/lm-host-view.gob"
 
542
self->editing_host = g_value_get_boolean (VAL);
 
543
#line 544 "lm-host-view.c"
 
544
                }
 
545
                break;
 
546
        case PROP_CAN_GO_UP:
 
547
                {
 
548
#line 71 "src/lm-host-view.gob"
 
549
self->can_go_up = g_value_get_boolean (VAL);
 
550
#line 551 "lm-host-view.c"
 
551
                }
 
552
                break;
 
553
        case PROP_CAN_GO_DOWN:
 
554
                {
 
555
#line 74 "src/lm-host-view.gob"
 
556
self->can_go_down = g_value_get_boolean (VAL);
 
557
#line 558 "lm-host-view.c"
 
558
                }
 
559
                break;
 
560
        default:
 
561
/* Apparently in g++ this is needed, glib is b0rk */
 
562
#ifndef __PRETTY_FUNCTION__
 
563
#  undef G_STRLOC
 
564
#  define G_STRLOC      __FILE__ ":" G_STRINGIFY (__LINE__)
 
565
#endif
 
566
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
567
                break;
 
568
        }
 
569
}
 
570
#undef __GOB_FUNCTION__
 
571
 
 
572
static void
 
573
___object_get_property (GObject *object,
 
574
        guint property_id,
 
575
        GValue *VAL G_GNUC_UNUSED,
 
576
        GParamSpec *pspec G_GNUC_UNUSED)
 
577
#define __GOB_FUNCTION__ "LM:Host:View::get_property"
 
578
{
 
579
        LMHostView *self G_GNUC_UNUSED;
 
580
 
 
581
        self = LM_HOST_VIEW (object);
 
582
 
 
583
        switch (property_id) {
 
584
        case PROP_APPLET:
 
585
                {
 
586
#line 53 "src/lm-host-view.gob"
 
587
g_value_set_pointer (VAL, self->_priv->applet);
 
588
#line 589 "lm-host-view.c"
 
589
                }
 
590
                break;
 
591
        case PROP_EDITING_HOST:
 
592
                {
 
593
#line 68 "src/lm-host-view.gob"
 
594
g_value_set_boolean (VAL, self->editing_host);
 
595
#line 596 "lm-host-view.c"
 
596
                }
 
597
                break;
 
598
        case PROP_CAN_GO_UP:
 
599
                {
 
600
#line 71 "src/lm-host-view.gob"
 
601
g_value_set_boolean (VAL, self->can_go_up);
 
602
#line 603 "lm-host-view.c"
 
603
                }
 
604
                break;
 
605
        case PROP_CAN_GO_DOWN:
 
606
                {
 
607
#line 74 "src/lm-host-view.gob"
 
608
g_value_set_boolean (VAL, self->can_go_down);
 
609
#line 610 "lm-host-view.c"
 
610
                }
 
611
                break;
 
612
        default:
 
613
/* Apparently in g++ this is needed, glib is b0rk */
 
614
#ifndef __PRETTY_FUNCTION__
 
615
#  undef G_STRLOC
 
616
#  define G_STRLOC      __FILE__ ":" G_STRINGIFY (__LINE__)
 
617
#endif
 
618
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
619
                break;
 
620
        }
 
621
}
 
622
#undef __GOB_FUNCTION__
 
623
 
 
624
 
 
625
#line 68 "src/lm-host-view.gob"
 
626
gboolean 
 
627
lm_host_view_get_editing_host (LMHostView * self)
 
628
{
 
629
#line 630 "lm-host-view.c"
 
630
#define __GOB_FUNCTION__ "LM:Host:View::get_editing_host"
 
631
{
 
632
#line 68 "src/lm-host-view.gob"
 
633
                gboolean val; g_object_get (G_OBJECT (self), "editing_host", &val, NULL); return val;
 
634
}}
 
635
#line 636 "lm-host-view.c"
 
636
#undef __GOB_FUNCTION__
 
637
 
 
638
#line 68 "src/lm-host-view.gob"
 
639
void 
 
640
lm_host_view_set_editing_host (LMHostView * self, gboolean val)
 
641
{
 
642
#line 643 "lm-host-view.c"
 
643
#define __GOB_FUNCTION__ "LM:Host:View::set_editing_host"
 
644
{
 
645
#line 68 "src/lm-host-view.gob"
 
646
                g_object_set (G_OBJECT (self), "editing_host", val, NULL);
 
647
}}
 
648
#line 649 "lm-host-view.c"
 
649
#undef __GOB_FUNCTION__
 
650
 
 
651
#line 71 "src/lm-host-view.gob"
 
652
gboolean 
 
653
lm_host_view_get_can_go_up (LMHostView * self)
 
654
{
 
655
#line 656 "lm-host-view.c"
 
656
#define __GOB_FUNCTION__ "LM:Host:View::get_can_go_up"
 
657
{
 
658
#line 71 "src/lm-host-view.gob"
 
659
                gboolean val; g_object_get (G_OBJECT (self), "can_go_up", &val, NULL); return val;
 
660
}}
 
661
#line 662 "lm-host-view.c"
 
662
#undef __GOB_FUNCTION__
 
663
 
 
664
#line 71 "src/lm-host-view.gob"
 
665
void 
 
666
lm_host_view_set_can_go_up (LMHostView * self, gboolean val)
 
667
{
 
668
#line 669 "lm-host-view.c"
 
669
#define __GOB_FUNCTION__ "LM:Host:View::set_can_go_up"
 
670
{
 
671
#line 71 "src/lm-host-view.gob"
 
672
                g_object_set (G_OBJECT (self), "can_go_up", val, NULL);
 
673
}}
 
674
#line 675 "lm-host-view.c"
 
675
#undef __GOB_FUNCTION__
 
676
 
 
677
#line 74 "src/lm-host-view.gob"
 
678
gboolean 
 
679
lm_host_view_get_can_go_down (LMHostView * self)
 
680
{
 
681
#line 682 "lm-host-view.c"
 
682
#define __GOB_FUNCTION__ "LM:Host:View::get_can_go_down"
 
683
{
 
684
#line 74 "src/lm-host-view.gob"
 
685
                gboolean val; g_object_get (G_OBJECT (self), "can_go_down", &val, NULL); return val;
 
686
}}
 
687
#line 688 "lm-host-view.c"
 
688
#undef __GOB_FUNCTION__
 
689
 
 
690
#line 74 "src/lm-host-view.gob"
 
691
void 
 
692
lm_host_view_set_can_go_down (LMHostView * self, gboolean val)
 
693
{
 
694
#line 695 "lm-host-view.c"
 
695
#define __GOB_FUNCTION__ "LM:Host:View::set_can_go_down"
 
696
{
 
697
#line 74 "src/lm-host-view.gob"
 
698
                g_object_set (G_OBJECT (self), "can_go_down", val, NULL);
 
699
}}
 
700
#line 701 "lm-host-view.c"
 
701
#undef __GOB_FUNCTION__
 
702
 
 
703
 
 
704
#line 104 "src/lm-host-view.gob"
 
705
static void 
 
706
lm_host_view_constructor (LMHostView * self)
 
707
{
 
708
#line 709 "lm-host-view.c"
 
709
#define __GOB_FUNCTION__ "LM:Host:View::constructor"
 
710
{
 
711
#line 105 "src/lm-host-view.gob"
 
712
        
 
713
    GtkMenuShell *shell;
 
714
    GtkWidget *add_item;
 
715
    GtkListStore *store;
 
716
    GtkCellRenderer *renderer;
 
717
    GtkTreeViewColumn *column;
 
718
    GtkTreeSelection *selection;
 
719
    int i;
 
720
 
 
721
    gtk_tree_view_set_reorderable(GTK_TREE_VIEW(self), TRUE);
 
722
    gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(self), self_search_equal_cb, NULL, NULL);
 
723
 
 
724
    shell = GTK_MENU_SHELL(selfp->menu);
 
725
 
 
726
    add_item = lm_menu_shell_append(shell, GTK_STOCK_ADD, NULL);
 
727
    selfp->remove_item = lm_menu_shell_append(shell, GTK_STOCK_REMOVE, NULL);
 
728
    lm_menu_shell_append(shell, NULL, NULL);
 
729
    selfp->up_item = lm_menu_shell_append(shell, GTK_STOCK_GO_UP, _("Move _Up"));
 
730
    selfp->down_item = lm_menu_shell_append(shell, GTK_STOCK_GO_DOWN, _("Move _Down"));
 
731
    lm_menu_shell_append(shell, NULL, NULL);
 
732
    selfp->cut_item = lm_menu_shell_append(shell, GTK_STOCK_CUT, NULL);
 
733
    selfp->copy_item = lm_menu_shell_append(shell, GTK_STOCK_COPY, NULL);
 
734
    selfp->paste_item = lm_menu_shell_append(shell, GTK_STOCK_PASTE, NULL);
 
735
    lm_menu_shell_append(shell, NULL, NULL);
 
736
    selfp->select_all_item = lm_menu_shell_append(shell, GTK_STOCK_SELECT_ALL, NULL);
 
737
 
 
738
    g_signal_connect_swapped(add_item, "activate", G_CALLBACK(self_activate_add), self);
 
739
    g_signal_connect_swapped(selfp->remove_item, "activate", G_CALLBACK(self_activate_remove), self);
 
740
    g_signal_connect(selfp->up_item, "activate", G_CALLBACK(self_up_activate_h), self);
 
741
    g_signal_connect(selfp->down_item, "activate", G_CALLBACK(self_down_activate_h), self);
 
742
    g_signal_connect_swapped(selfp->cut_item, "activate", G_CALLBACK(self_activate_cut), self);
 
743
    g_signal_connect_swapped(selfp->copy_item, "activate", G_CALLBACK(self_activate_copy), self);
 
744
    g_signal_connect_swapped(selfp->paste_item, "activate", G_CALLBACK(self_activate_paste), self);
 
745
    g_signal_connect(selfp->select_all_item, "activate", G_CALLBACK(self_select_all_activate_h), self);
 
746
 
 
747
    store = gtk_list_store_new(N_COLUMNS,
 
748
                               LM_TYPE_HOST_FRONTEND,
 
749
                               GDK_TYPE_COLOR,
 
750
                               G_TYPE_STRING);
 
751
    gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(store));
 
752
 
 
753
    renderer = lm_cell_renderer_color_new();
 
754
    g_signal_connect(renderer, "activated", G_CALLBACK(self_color_activated_h), self);
 
755
 
 
756
    column = gtk_tree_view_column_new_with_attributes(_("Color"),
 
757
                                                      renderer,
 
758
                                                      "color", COLUMN_COLOR,
 
759
                                                      NULL);
 
760
    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
 
761
    gtk_tree_view_append_column(GTK_TREE_VIEW(self), column);
 
762
 
 
763
    renderer = gtk_cell_renderer_text_new();
 
764
    g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL);
 
765
    g_object_connect(renderer,
 
766
                     "signal::editing-started", self_editing_started_h, self,
 
767
                     "signal::editing-canceled", self_editing_canceled_h, self,
 
768
                     "signal::edited", self_edited_h, self,
 
769
                     NULL);
 
770
 
 
771
    column = gtk_tree_view_column_new_with_attributes(_("Host"),
 
772
                                                      renderer,
 
773
                                                      "text", COLUMN_NAME,
 
774
                                                      NULL);
 
775
    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
 
776
    gtk_tree_view_append_column(GTK_TREE_VIEW(self), column);
 
777
 
 
778
    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
 
779
    gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
 
780
    g_signal_connect(selection, "changed", G_CALLBACK(self_selection_changed_h), self);
 
781
 
 
782
    /* fill */
 
783
    LM_ARRAY_FOREACH(i, selfp->applet->hosts)
 
784
      {
 
785
        LMHostFrontend *host = g_ptr_array_index(selfp->applet->hosts, i);
 
786
        GtkTreeIter iter;
 
787
 
 
788
        gtk_list_store_insert_with_values(store, &iter,
 
789
                                          G_MAXINT,
 
790
                                          COLUMN_HOST, host,
 
791
                                          COLUMN_COLOR, &host->color,
 
792
                                          COLUMN_NAME, LM_HOST(host)->name,
 
793
                                          -1);
 
794
      }
 
795
 
 
796
    g_object_connect(store,
 
797
                     /* for the sensitivity of "Select All" */
 
798
                     "swapped-signal::row-inserted", self_update_sensitivity, self,
 
799
                     "swapped-signal::row-deleted", self_update_sensitivity, self,
 
800
                     /* handle row dnd */
 
801
                     "swapped-signal::row-deleted", self_reorder, self,
 
802
                     NULL);
 
803
 
 
804
    g_object_unref(store);
 
805
 
 
806
    g_object_connect(self,
 
807
                     "signal::popup-menu", self_popup_menu_h, NULL,
 
808
                     "signal::button-press-event", self_button_press_event_h, NULL,
 
809
                     NULL);
 
810
 
 
811
    self_update_sensitivity(self);
 
812
  }}
 
813
#line 814 "lm-host-view.c"
 
814
#undef __GOB_FUNCTION__
 
815
 
 
816
#line 207 "src/lm-host-view.gob"
 
817
static GSList * 
 
818
lm_host_view_get_selected_rows (LMHostView * self)
 
819
{
 
820
#line 821 "lm-host-view.c"
 
821
#define __GOB_FUNCTION__ "LM:Host:View::get_selected_rows"
 
822
#line 207 "src/lm-host-view.gob"
 
823
        g_return_val_if_fail (self != NULL, (GSList * )0);
 
824
#line 207 "src/lm-host-view.gob"
 
825
        g_return_val_if_fail (LM_IS_HOST_VIEW (self), (GSList * )0);
 
826
#line 827 "lm-host-view.c"
 
827
{
 
828
#line 209 "src/lm-host-view.gob"
 
829
        
 
830
    GtkTreeModel *model;
 
831
    GtkTreeSelection *selection;
 
832
    GList *paths;
 
833
    GList *l;
 
834
    GSList *references = NULL;
 
835
 
 
836
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
837
    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
 
838
    paths = gtk_tree_selection_get_selected_rows(selection, NULL);
 
839
 
 
840
    LM_LIST_FOREACH(l, paths)
 
841
      {
 
842
        GtkTreePath *path = l->data;
 
843
 
 
844
        references = g_slist_append(references, gtk_tree_row_reference_new(model, path));
 
845
        gtk_tree_path_free(path);
 
846
      }
 
847
    g_list_free(paths);
 
848
 
 
849
    return references;
 
850
  }}
 
851
#line 852 "lm-host-view.c"
 
852
#undef __GOB_FUNCTION__
 
853
 
 
854
#line 232 "src/lm-host-view.gob"
 
855
static void 
 
856
lm_host_view_store_remove (LMHostView * self, GtkListStore * store, GtkTreeIter * iter)
 
857
{
 
858
#line 859 "lm-host-view.c"
 
859
#define __GOB_FUNCTION__ "LM:Host:View::store_remove"
 
860
#line 232 "src/lm-host-view.gob"
 
861
        g_return_if_fail (self != NULL);
 
862
#line 232 "src/lm-host-view.gob"
 
863
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
864
#line 232 "src/lm-host-view.gob"
 
865
        g_return_if_fail (store != NULL);
 
866
#line 232 "src/lm-host-view.gob"
 
867
        g_return_if_fail (GTK_IS_LIST_STORE (store));
 
868
#line 232 "src/lm-host-view.gob"
 
869
        g_return_if_fail (iter != NULL);
 
870
#line 871 "lm-host-view.c"
 
871
{
 
872
#line 236 "src/lm-host-view.gob"
 
873
        
 
874
    /* block dnd handler */
 
875
    g_signal_handlers_block_by_func(store, self_reorder, self);
 
876
    gtk_list_store_remove(store, iter);
 
877
    g_signal_handlers_unblock_by_func(store, self_reorder, self);
 
878
  }}
 
879
#line 880 "lm-host-view.c"
 
880
#undef __GOB_FUNCTION__
 
881
 
 
882
#line 243 "src/lm-host-view.gob"
 
883
static void 
 
884
lm_host_view_reorder (LMHostView * self)
 
885
{
 
886
#line 887 "lm-host-view.c"
 
887
#define __GOB_FUNCTION__ "LM:Host:View::reorder"
 
888
#line 243 "src/lm-host-view.gob"
 
889
        g_return_if_fail (self != NULL);
 
890
#line 243 "src/lm-host-view.gob"
 
891
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
892
#line 893 "lm-host-view.c"
 
893
{
 
894
#line 245 "src/lm-host-view.gob"
 
895
        
 
896
    GtkTreeModel *model;
 
897
    gboolean valid;
 
898
    GtkTreeIter iter;
 
899
    GSList *hosts = NULL;
 
900
 
 
901
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
902
    valid = gtk_tree_model_get_iter_first(model, &iter);
 
903
 
 
904
    while (valid)
 
905
      {
 
906
        LMHostFrontend *host;
 
907
 
 
908
        gtk_tree_model_get(model, &iter, COLUMN_HOST, &host, -1);
 
909
        hosts = g_slist_append(hosts, host);
 
910
 
 
911
        valid = gtk_tree_model_iter_next(model, &iter);
 
912
      }
 
913
 
 
914
    lm_applet_reorder_hosts(selfp->applet, hosts);
 
915
    lm_g_object_slist_free(hosts);
 
916
  }}
 
917
#line 918 "lm-host-view.c"
 
918
#undef __GOB_FUNCTION__
 
919
 
 
920
#line 268 "src/lm-host-view.gob"
 
921
void 
 
922
lm_host_view_activate_add (LMHostView * self)
 
923
{
 
924
#line 925 "lm-host-view.c"
 
925
        GValue ___param_values[1];
 
926
        GValue ___return_val;
 
927
 
 
928
memset (&___return_val, 0, sizeof (___return_val));
 
929
memset (&___param_values, 0, sizeof (___param_values));
 
930
 
 
931
#line 268 "src/lm-host-view.gob"
 
932
        g_return_if_fail (self != NULL);
 
933
#line 268 "src/lm-host-view.gob"
 
934
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
935
#line 936 "lm-host-view.c"
 
936
 
 
937
        ___param_values[0].g_type = 0;
 
938
        g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
 
939
        g_value_set_instance (&___param_values[0], (gpointer) self);
 
940
 
 
941
        g_signal_emitv (___param_values,
 
942
                object_signals[ACTIVATE_ADD_SIGNAL],
 
943
                0 /* detail */,
 
944
                &___return_val);
 
945
 
 
946
        g_value_unset (&___param_values[0]);
 
947
}
 
948
#line 268 "src/lm-host-view.gob"
 
949
static void 
 
950
___real_lm_host_view_activate_add (LMHostView * self)
 
951
{
 
952
#line 953 "lm-host-view.c"
 
953
#define __GOB_FUNCTION__ "LM:Host:View::activate_add"
 
954
{
 
955
#line 270 "src/lm-host-view.gob"
 
956
        
 
957
    GtkTreeModel *model;
 
958
    GtkTreePath *path;
 
959
    GtkTreeViewColumn *column;
 
960
 
 
961
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
962
    gtk_list_store_append(GTK_LIST_STORE(model), &selfp->add_pending_iter);
 
963
    selfp->add_pending_count++;
 
964
 
 
965
    path = gtk_tree_model_get_path(model, &selfp->add_pending_iter);
 
966
    column = gtk_tree_view_get_column(GTK_TREE_VIEW(self), 1);
 
967
 
 
968
    gtk_widget_grab_focus(GTK_WIDGET(self));
 
969
    gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(self), path, column, FALSE, 0, 0);
 
970
    gtk_tree_view_set_cursor(GTK_TREE_VIEW(self), path, column, TRUE);
 
971
    gtk_tree_path_free(path);
 
972
  }}
 
973
#line 974 "lm-host-view.c"
 
974
#undef __GOB_FUNCTION__
 
975
 
 
976
#line 288 "src/lm-host-view.gob"
 
977
void 
 
978
lm_host_view_activate_move (LMHostView * self, int direction)
 
979
{
 
980
#line 981 "lm-host-view.c"
 
981
        GValue ___param_values[2];
 
982
        GValue ___return_val;
 
983
 
 
984
memset (&___return_val, 0, sizeof (___return_val));
 
985
memset (&___param_values, 0, sizeof (___param_values));
 
986
 
 
987
#line 288 "src/lm-host-view.gob"
 
988
        g_return_if_fail (self != NULL);
 
989
#line 288 "src/lm-host-view.gob"
 
990
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
991
#line 992 "lm-host-view.c"
 
992
 
 
993
        ___param_values[0].g_type = 0;
 
994
        g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
 
995
        g_value_set_instance (&___param_values[0], (gpointer) self);
 
996
 
 
997
        ___param_values[1].g_type = 0;
 
998
        g_value_init (&___param_values[1], G_TYPE_INT);
 
999
        g_value_set_int (&___param_values[1], (gint ) direction);
 
1000
 
 
1001
        g_signal_emitv (___param_values,
 
1002
                object_signals[ACTIVATE_MOVE_SIGNAL],
 
1003
                0 /* detail */,
 
1004
                &___return_val);
 
1005
 
 
1006
        g_value_unset (&___param_values[0]);
 
1007
        g_value_unset (&___param_values[1]);
 
1008
}
 
1009
#line 288 "src/lm-host-view.gob"
 
1010
static void 
 
1011
___real_lm_host_view_activate_move (LMHostView * self, int direction)
 
1012
{
 
1013
#line 1014 "lm-host-view.c"
 
1014
#define __GOB_FUNCTION__ "LM:Host:View::activate_move"
 
1015
{
 
1016
#line 290 "src/lm-host-view.gob"
 
1017
        
 
1018
    GtkTreeModel *model;
 
1019
    GSList *references;
 
1020
    GSList *l;
 
1021
 
 
1022
    g_return_if_fail(direction == -1 || direction == +1);
 
1023
 
 
1024
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
1025
    references = self_get_selected_rows(self);
 
1026
    if (direction == +1)
 
1027
      references = g_slist_reverse(references);
 
1028
 
 
1029
    LM_LIST_FOREACH(l, references)
 
1030
      {
 
1031
        GtkTreeRowReference *reference = l->data;
 
1032
        GtkTreePath *path;
 
1033
        GtkTreeIter iter;
 
1034
        GtkTreeIter other_iter;
 
1035
        gboolean status;
 
1036
 
 
1037
        path = gtk_tree_row_reference_get_path(reference);
 
1038
 
 
1039
        status = gtk_tree_model_get_iter(model, &iter, path);
 
1040
        g_assert(status == TRUE);
 
1041
 
 
1042
        if (direction == -1)
 
1043
          gtk_tree_path_prev(path);
 
1044
        else
 
1045
          gtk_tree_path_next(path);
 
1046
 
 
1047
        if (gtk_tree_model_get_iter(model, &other_iter, path))
 
1048
          {
 
1049
            LMHostFrontend *host;
 
1050
            LMHostFrontend *other_host;
 
1051
 
 
1052
            gtk_tree_model_get(model, &iter, COLUMN_HOST, &host, -1);
 
1053
            gtk_tree_model_get(model, &other_iter, COLUMN_HOST, &other_host, -1);
 
1054
 
 
1055
            gtk_list_store_swap(GTK_LIST_STORE(model), &iter, &other_iter);
 
1056
 
 
1057
            g_object_unref(host);
 
1058
            g_object_unref(other_host);
 
1059
          }
 
1060
 
 
1061
        gtk_tree_path_free(path);
 
1062
        gtk_tree_row_reference_free(reference);
 
1063
      }
 
1064
    g_slist_free(references);
 
1065
 
 
1066
    self_reorder(self);
 
1067
    self_update_sensitivity(self); /* for up and down */
 
1068
  }}
 
1069
#line 1070 "lm-host-view.c"
 
1070
#undef __GOB_FUNCTION__
 
1071
 
 
1072
#line 343 "src/lm-host-view.gob"
 
1073
void 
 
1074
lm_host_view_activate_remove (LMHostView * self)
 
1075
{
 
1076
#line 1077 "lm-host-view.c"
 
1077
        GValue ___param_values[1];
 
1078
        GValue ___return_val;
 
1079
 
 
1080
memset (&___return_val, 0, sizeof (___return_val));
 
1081
memset (&___param_values, 0, sizeof (___param_values));
 
1082
 
 
1083
#line 343 "src/lm-host-view.gob"
 
1084
        g_return_if_fail (self != NULL);
 
1085
#line 343 "src/lm-host-view.gob"
 
1086
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
1087
#line 1088 "lm-host-view.c"
 
1088
 
 
1089
        ___param_values[0].g_type = 0;
 
1090
        g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
 
1091
        g_value_set_instance (&___param_values[0], (gpointer) self);
 
1092
 
 
1093
        g_signal_emitv (___param_values,
 
1094
                object_signals[ACTIVATE_REMOVE_SIGNAL],
 
1095
                0 /* detail */,
 
1096
                &___return_val);
 
1097
 
 
1098
        g_value_unset (&___param_values[0]);
 
1099
}
 
1100
#line 343 "src/lm-host-view.gob"
 
1101
static void 
 
1102
___real_lm_host_view_activate_remove (LMHostView * self)
 
1103
{
 
1104
#line 1105 "lm-host-view.c"
 
1105
#define __GOB_FUNCTION__ "LM:Host:View::activate_remove"
 
1106
{
 
1107
#line 345 "src/lm-host-view.gob"
 
1108
        
 
1109
    self_remove_selected_hosts(self);
 
1110
  }}
 
1111
#line 1112 "lm-host-view.c"
 
1112
#undef __GOB_FUNCTION__
 
1113
 
 
1114
#line 349 "src/lm-host-view.gob"
 
1115
static void 
 
1116
lm_host_view_remove_selected_hosts (LMHostView * self)
 
1117
{
 
1118
#line 1119 "lm-host-view.c"
 
1119
#define __GOB_FUNCTION__ "LM:Host:View::remove_selected_hosts"
 
1120
#line 349 "src/lm-host-view.gob"
 
1121
        g_return_if_fail (self != NULL);
 
1122
#line 349 "src/lm-host-view.gob"
 
1123
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
1124
#line 1125 "lm-host-view.c"
 
1125
{
 
1126
#line 351 "src/lm-host-view.gob"
 
1127
        
 
1128
    GtkTreeModel *model;
 
1129
    GSList *references;
 
1130
    GSList *l;
 
1131
 
 
1132
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
1133
    references = self_get_selected_rows(self);
 
1134
    LM_LIST_FOREACH(l, references)
 
1135
      {
 
1136
        GtkTreeRowReference *reference = l->data;
 
1137
        GtkTreeIter iter;
 
1138
        gboolean status;
 
1139
        LMHostFrontend *host;
 
1140
 
 
1141
        /* if the color dialog is associated with the host, destroy it */
 
1142
        if (selfp->color_dialog_row_reference
 
1143
            && ! lm_tree_row_reference_compare(reference,
 
1144
                                               selfp->color_dialog_row_reference))
 
1145
          gtk_widget_destroy(selfp->color_dialog);
 
1146
 
 
1147
        status = lm_tree_row_reference_get_iter(reference, &iter);
 
1148
        g_assert(status == TRUE);
 
1149
 
 
1150
        gtk_tree_model_get(model, &iter, COLUMN_HOST, &host, -1);
 
1151
 
 
1152
        lm_applet_remove_host(selfp->applet, host);
 
1153
        self_store_remove(self, GTK_LIST_STORE(model), &iter);
 
1154
 
 
1155
        g_object_unref(host);
 
1156
        gtk_tree_row_reference_free(reference);
 
1157
      }
 
1158
    g_slist_free(references);
 
1159
  }}
 
1160
#line 1161 "lm-host-view.c"
 
1161
#undef __GOB_FUNCTION__
 
1162
 
 
1163
#line 385 "src/lm-host-view.gob"
 
1164
static void 
 
1165
lm_host_view_copy_selected_hosts (LMHostView * self)
 
1166
{
 
1167
#line 1168 "lm-host-view.c"
 
1168
#define __GOB_FUNCTION__ "LM:Host:View::copy_selected_hosts"
 
1169
#line 385 "src/lm-host-view.gob"
 
1170
        g_return_if_fail (self != NULL);
 
1171
#line 385 "src/lm-host-view.gob"
 
1172
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
1173
#line 1174 "lm-host-view.c"
 
1174
{
 
1175
#line 387 "src/lm-host-view.gob"
 
1176
        
 
1177
    GSList *host_configs = NULL;
 
1178
    GtkTreeModel *model;
 
1179
    GSList *references;
 
1180
    GSList *l;
 
1181
    gboolean status;
 
1182
    static const GtkTargetEntry init_target_table[] = {
 
1183
      { CLIPBOARD_TARGET_NATIVE_NAME, 0, CLIPBOARD_TARGET_NATIVE }
 
1184
    };
 
1185
    GtkTargetList *target_list;
 
1186
    GtkTargetEntry *target_table;
 
1187
    int target_table_len;
 
1188
 
 
1189
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
1190
 
 
1191
    references = self_get_selected_rows(self);
 
1192
    LM_LIST_FOREACH(l, references)
 
1193
      {
 
1194
        GtkTreeRowReference *reference = l->data;
 
1195
        GtkTreePath *path;
 
1196
        GtkTreeIter iter;
 
1197
        LMHostFrontend *host;
 
1198
 
 
1199
        path = gtk_tree_row_reference_get_path(reference);
 
1200
        status = gtk_tree_model_get_iter(model, &iter, path);
 
1201
        g_assert(status == TRUE);
 
1202
        gtk_tree_path_free(path);
 
1203
 
 
1204
        gtk_tree_model_get(model, &iter, COLUMN_HOST, &host, -1);
 
1205
        host_configs = g_slist_append(host_configs, lm_host_frontend_get_configuration(host));
 
1206
        g_object_unref(host);
 
1207
 
 
1208
        gtk_tree_row_reference_free(reference);
 
1209
      }
 
1210
    g_slist_free(references);
 
1211
 
 
1212
    target_list = gtk_target_list_new(init_target_table, G_N_ELEMENTS(init_target_table));
 
1213
    gtk_target_list_add_text_targets(target_list, CLIPBOARD_TARGET_TEXT);
 
1214
 
 
1215
    target_table = gtk_target_table_new_from_list(target_list, &target_table_len);
 
1216
    gtk_target_list_unref(target_list);
 
1217
 
 
1218
    status = gtk_clipboard_set_with_data(global_clipboard,
 
1219
                                         target_table,
 
1220
                                         target_table_len,
 
1221
                                         self_get_clipboard_cb,
 
1222
                                         self_clear_clipboard_cb,
 
1223
                                         host_configs);
 
1224
    g_assert(status == TRUE);
 
1225
 
 
1226
    gtk_target_table_free(target_table, target_table_len);
 
1227
  }}
 
1228
#line 1229 "lm-host-view.c"
 
1229
#undef __GOB_FUNCTION__
 
1230
 
 
1231
#line 440 "src/lm-host-view.gob"
 
1232
static void 
 
1233
lm_host_view_get_clipboard_cb (GtkClipboard * clipboard, GtkSelectionData * selection_data, unsigned int info, gpointer user_data_or_owner)
 
1234
{
 
1235
#line 1236 "lm-host-view.c"
 
1236
#define __GOB_FUNCTION__ "LM:Host:View::get_clipboard_cb"
 
1237
{
 
1238
#line 445 "src/lm-host-view.gob"
 
1239
        
 
1240
    GSList *host_configs = user_data_or_owner;
 
1241
    GSList *l;
 
1242
 
 
1243
    switch ((ClipboardTarget) info)
 
1244
      {
 
1245
      case CLIPBOARD_TARGET_NATIVE:
 
1246
        gtk_selection_data_set(selection_data,
 
1247
                               clipboard_target_native_atom,
 
1248
                               8,
 
1249
                               (unsigned char *) &host_configs,
 
1250
                               sizeof(host_configs));
 
1251
        break;
 
1252
 
 
1253
      case CLIPBOARD_TARGET_TEXT:
 
1254
        {
 
1255
          GString *str;
 
1256
 
 
1257
          str = g_string_new(NULL);
 
1258
 
 
1259
          LM_LIST_FOREACH(l, host_configs)
 
1260
            {
 
1261
              LMHostFrontendConfiguration *config = l->data;
 
1262
 
 
1263
              g_string_append(str, config->name);
 
1264
 
 
1265
              if (l->next)
 
1266
                g_string_append_c(str, '\n');
 
1267
            }
 
1268
 
 
1269
          gtk_selection_data_set_text(selection_data, str->str, str->len);
 
1270
          g_string_free(str, TRUE);
 
1271
        }
 
1272
        break;
 
1273
 
 
1274
      default:
 
1275
        g_assert_not_reached();
 
1276
        break;
 
1277
      }
 
1278
  }}
 
1279
#line 1280 "lm-host-view.c"
 
1280
#undef __GOB_FUNCTION__
 
1281
 
 
1282
#line 486 "src/lm-host-view.gob"
 
1283
static void 
 
1284
lm_host_view_clear_clipboard_cb (GtkClipboard * clipboard, gpointer user_data_or_owner)
 
1285
{
 
1286
#line 1287 "lm-host-view.c"
 
1287
#define __GOB_FUNCTION__ "LM:Host:View::clear_clipboard_cb"
 
1288
{
 
1289
#line 488 "src/lm-host-view.gob"
 
1290
        
 
1291
    GSList *host_configs = user_data_or_owner;
 
1292
 
 
1293
    lm_g_slist_free_deep_custom(host_configs, (GFunc) lm_host_frontend_configuration_free, NULL);
 
1294
  }}
 
1295
#line 1296 "lm-host-view.c"
 
1296
#undef __GOB_FUNCTION__
 
1297
 
 
1298
#line 494 "src/lm-host-view.gob"
 
1299
static void 
 
1300
lm_host_view_activate_cut (LMHostView * self)
 
1301
{
 
1302
#line 1303 "lm-host-view.c"
 
1303
        GValue ___param_values[1];
 
1304
        GValue ___return_val;
 
1305
 
 
1306
memset (&___return_val, 0, sizeof (___return_val));
 
1307
memset (&___param_values, 0, sizeof (___param_values));
 
1308
 
 
1309
#line 494 "src/lm-host-view.gob"
 
1310
        g_return_if_fail (self != NULL);
 
1311
#line 494 "src/lm-host-view.gob"
 
1312
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
1313
#line 1314 "lm-host-view.c"
 
1314
 
 
1315
        ___param_values[0].g_type = 0;
 
1316
        g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
 
1317
        g_value_set_instance (&___param_values[0], (gpointer) self);
 
1318
 
 
1319
        g_signal_emitv (___param_values,
 
1320
                object_signals[ACTIVATE_CUT_SIGNAL],
 
1321
                0 /* detail */,
 
1322
                &___return_val);
 
1323
 
 
1324
        g_value_unset (&___param_values[0]);
 
1325
}
 
1326
#line 494 "src/lm-host-view.gob"
 
1327
static void 
 
1328
___real_lm_host_view_activate_cut (LMHostView * self)
 
1329
{
 
1330
#line 1331 "lm-host-view.c"
 
1331
#define __GOB_FUNCTION__ "LM:Host:View::activate_cut"
 
1332
{
 
1333
#line 496 "src/lm-host-view.gob"
 
1334
        
 
1335
    self_copy_selected_hosts(self);
 
1336
    self_remove_selected_hosts(self);
 
1337
  }}
 
1338
#line 1339 "lm-host-view.c"
 
1339
#undef __GOB_FUNCTION__
 
1340
 
 
1341
#line 501 "src/lm-host-view.gob"
 
1342
static void 
 
1343
lm_host_view_activate_copy (LMHostView * self)
 
1344
{
 
1345
#line 1346 "lm-host-view.c"
 
1346
        GValue ___param_values[1];
 
1347
        GValue ___return_val;
 
1348
 
 
1349
memset (&___return_val, 0, sizeof (___return_val));
 
1350
memset (&___param_values, 0, sizeof (___param_values));
 
1351
 
 
1352
#line 501 "src/lm-host-view.gob"
 
1353
        g_return_if_fail (self != NULL);
 
1354
#line 501 "src/lm-host-view.gob"
 
1355
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
1356
#line 1357 "lm-host-view.c"
 
1357
 
 
1358
        ___param_values[0].g_type = 0;
 
1359
        g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
 
1360
        g_value_set_instance (&___param_values[0], (gpointer) self);
 
1361
 
 
1362
        g_signal_emitv (___param_values,
 
1363
                object_signals[ACTIVATE_COPY_SIGNAL],
 
1364
                0 /* detail */,
 
1365
                &___return_val);
 
1366
 
 
1367
        g_value_unset (&___param_values[0]);
 
1368
}
 
1369
#line 501 "src/lm-host-view.gob"
 
1370
static void 
 
1371
___real_lm_host_view_activate_copy (LMHostView * self)
 
1372
{
 
1373
#line 1374 "lm-host-view.c"
 
1374
#define __GOB_FUNCTION__ "LM:Host:View::activate_copy"
 
1375
{
 
1376
#line 503 "src/lm-host-view.gob"
 
1377
        
 
1378
    self_copy_selected_hosts(self);
 
1379
  }}
 
1380
#line 1381 "lm-host-view.c"
 
1381
#undef __GOB_FUNCTION__
 
1382
 
 
1383
#line 507 "src/lm-host-view.gob"
 
1384
static void 
 
1385
lm_host_view_activate_paste (LMHostView * self)
 
1386
{
 
1387
#line 1388 "lm-host-view.c"
 
1388
        GValue ___param_values[1];
 
1389
        GValue ___return_val;
 
1390
 
 
1391
memset (&___return_val, 0, sizeof (___return_val));
 
1392
memset (&___param_values, 0, sizeof (___param_values));
 
1393
 
 
1394
#line 507 "src/lm-host-view.gob"
 
1395
        g_return_if_fail (self != NULL);
 
1396
#line 507 "src/lm-host-view.gob"
 
1397
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
1398
#line 1399 "lm-host-view.c"
 
1399
 
 
1400
        ___param_values[0].g_type = 0;
 
1401
        g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
 
1402
        g_value_set_instance (&___param_values[0], (gpointer) self);
 
1403
 
 
1404
        g_signal_emitv (___param_values,
 
1405
                object_signals[ACTIVATE_PASTE_SIGNAL],
 
1406
                0 /* detail */,
 
1407
                &___return_val);
 
1408
 
 
1409
        g_value_unset (&___param_values[0]);
 
1410
}
 
1411
#line 507 "src/lm-host-view.gob"
 
1412
static void 
 
1413
___real_lm_host_view_activate_paste (LMHostView * self)
 
1414
{
 
1415
#line 1416 "lm-host-view.c"
 
1416
#define __GOB_FUNCTION__ "LM:Host:View::activate_paste"
 
1417
{
 
1418
#line 509 "src/lm-host-view.gob"
 
1419
        
 
1420
    GtkSelectionData *data;
 
1421
    char *text;
 
1422
 
 
1423
    data = gtk_clipboard_wait_for_contents(global_clipboard, clipboard_target_native_atom);
 
1424
    if (data)
 
1425
      {
 
1426
        GSList *host_configs;
 
1427
        GSList *l;
 
1428
 
 
1429
        memcpy(&host_configs, data->data, data->length);
 
1430
 
 
1431
        LM_LIST_FOREACH(l, host_configs)
 
1432
          {
 
1433
            LMHostFrontendConfiguration *config = l->data;
 
1434
            LMHostFrontend *host;
 
1435
 
 
1436
            host = lm_host_frontend_new_from_configuration(selfp->applet, config);
 
1437
            self_add_host(self, host);
 
1438
            g_object_unref(host);
 
1439
          }
 
1440
 
 
1441
        gtk_selection_data_free(data);
 
1442
        return;
 
1443
      }
 
1444
 
 
1445
    text = gtk_clipboard_wait_for_text(global_clipboard);
 
1446
    if (text)
 
1447
      {
 
1448
        char **hosts;
 
1449
        int i;
 
1450
 
 
1451
        hosts = g_strsplit(text, "\n", 0);
 
1452
        g_free(text);
 
1453
 
 
1454
        for (i = 0; hosts[i]; i++)
 
1455
          {
 
1456
            LMHostFrontend *host;
 
1457
 
 
1458
            host = lm_host_frontend_new(selfp->applet, hosts[i], NULL);
 
1459
            self_add_host(self, host);
 
1460
            g_object_unref(host);
 
1461
          }
 
1462
 
 
1463
        g_strfreev(hosts);
 
1464
      }
 
1465
  }}
 
1466
#line 1467 "lm-host-view.c"
 
1467
#undef __GOB_FUNCTION__
 
1468
 
 
1469
#line 557 "src/lm-host-view.gob"
 
1470
static void 
 
1471
lm_host_view_add_host (LMHostView * self, LMHostFrontend * host)
 
1472
{
 
1473
#line 1474 "lm-host-view.c"
 
1474
#define __GOB_FUNCTION__ "LM:Host:View::add_host"
 
1475
#line 557 "src/lm-host-view.gob"
 
1476
        g_return_if_fail (self != NULL);
 
1477
#line 557 "src/lm-host-view.gob"
 
1478
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
1479
#line 557 "src/lm-host-view.gob"
 
1480
        g_return_if_fail (host != NULL);
 
1481
#line 557 "src/lm-host-view.gob"
 
1482
        g_return_if_fail (LM_IS_HOST_FRONTEND (host));
 
1483
#line 1484 "lm-host-view.c"
 
1484
{
 
1485
#line 559 "src/lm-host-view.gob"
 
1486
        
 
1487
    GtkTreeModel *model;
 
1488
    GtkTreeIter iter;
 
1489
 
 
1490
    lm_applet_add_host(selfp->applet, host);
 
1491
 
 
1492
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
1493
 
 
1494
    gtk_list_store_insert_with_values(GTK_LIST_STORE(model), &iter,
 
1495
                                      G_MAXINT,
 
1496
                                      COLUMN_HOST, host,
 
1497
                                      COLUMN_COLOR, &host->color,
 
1498
                                      COLUMN_NAME, LM_HOST(host)->name,
 
1499
                                      -1);
 
1500
  }}
 
1501
#line 1502 "lm-host-view.c"
 
1502
#undef __GOB_FUNCTION__
 
1503
 
 
1504
#line 575 "src/lm-host-view.gob"
 
1505
static void 
 
1506
lm_host_view_selection_changed_h (GtkTreeSelection * selection, gpointer user_data)
 
1507
{
 
1508
#line 1509 "lm-host-view.c"
 
1509
#define __GOB_FUNCTION__ "LM:Host:View::selection_changed_h"
 
1510
{
 
1511
#line 578 "src/lm-host-view.gob"
 
1512
        
 
1513
    Self *self = user_data;
 
1514
 
 
1515
    self_update_sensitivity(self);
 
1516
  }}
 
1517
#line 1518 "lm-host-view.c"
 
1518
#undef __GOB_FUNCTION__
 
1519
 
 
1520
#line 584 "src/lm-host-view.gob"
 
1521
static void 
 
1522
lm_host_view_color_activated_h (LMCellRendererColor * renderer, const char * path, gpointer user_data)
 
1523
{
 
1524
#line 1525 "lm-host-view.c"
 
1525
#define __GOB_FUNCTION__ "LM:Host:View::color_activated_h"
 
1526
{
 
1527
#line 588 "src/lm-host-view.gob"
 
1528
        
 
1529
    Self *self = user_data;
 
1530
    GtkTreeModel *model;
 
1531
    GtkTreeIter iter;
 
1532
    gboolean status;
 
1533
    LMHostFrontend *host;
 
1534
    GtkWindow *parent_window;
 
1535
 
 
1536
    if (! selfp->color_dialog)
 
1537
      {
 
1538
        selfp->color_dialog = gtk_color_selection_dialog_new(_("Pick a Color"));
 
1539
 
 
1540
        g_object_weak_ref(G_OBJECT(selfp->color_dialog), self_color_dialog_weak_notify_cb, self);
 
1541
 
 
1542
        g_signal_connect(selfp->color_dialog, "response", G_CALLBACK(self_color_dialog_response_h), self);
 
1543
      }
 
1544
 
 
1545
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
1546
 
 
1547
    status = gtk_tree_model_get_iter_from_string(model, &iter, path);
 
1548
    g_assert(status == TRUE);
 
1549
 
 
1550
    gtk_tree_model_get(model, &iter, COLUMN_HOST, &host, -1);
 
1551
    gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(selfp->color_dialog)->colorsel), &host->color);
 
1552
    g_object_unref(host);
 
1553
 
 
1554
    gtk_tree_row_reference_free(selfp->color_dialog_row_reference);
 
1555
    selfp->color_dialog_row_reference = lm_tree_row_reference_new_from_path_string(model, path);
 
1556
 
 
1557
    parent_window = lm_widget_get_parent_window(GTK_WIDGET(self));
 
1558
    if (parent_window)
 
1559
      {
 
1560
        if (parent_window != gtk_window_get_transient_for(GTK_WINDOW(selfp->color_dialog)))
 
1561
          gtk_window_set_transient_for(GTK_WINDOW(selfp->color_dialog), parent_window);
 
1562
 
 
1563
        gtk_window_set_modal(GTK_WINDOW(selfp->color_dialog), gtk_window_get_modal(parent_window));
 
1564
      }
 
1565
 
 
1566
    lm_window_present_from_event(GTK_WINDOW(selfp->color_dialog));
 
1567
  }}
 
1568
#line 1569 "lm-host-view.c"
 
1569
#undef __GOB_FUNCTION__
 
1570
 
 
1571
#line 629 "src/lm-host-view.gob"
 
1572
static void 
 
1573
lm_host_view_color_dialog_response_h (GtkDialog * dialog, int response, gpointer user_data)
 
1574
{
 
1575
#line 1576 "lm-host-view.c"
 
1576
#define __GOB_FUNCTION__ "LM:Host:View::color_dialog_response_h"
 
1577
{
 
1578
#line 633 "src/lm-host-view.gob"
 
1579
        
 
1580
    Self *self = user_data;
 
1581
 
 
1582
    if (response == GTK_RESPONSE_OK)
 
1583
      {
 
1584
        GdkColor color;
 
1585
        GtkTreeModel *model;
 
1586
        GtkTreeIter iter;
 
1587
        gboolean status;
 
1588
        LMHostFrontend *host;
 
1589
 
 
1590
        gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel), &color);
 
1591
 
 
1592
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
1593
 
 
1594
        status = lm_tree_row_reference_get_iter(selfp->color_dialog_row_reference, &iter);
 
1595
        g_assert(status == TRUE);
 
1596
 
 
1597
        gtk_tree_model_get(model, &iter, COLUMN_HOST, &host, -1);
 
1598
        lm_host_frontend_set_color(host, &color);
 
1599
        g_object_unref(host);
 
1600
 
 
1601
        gtk_list_store_set(GTK_LIST_STORE(model), &iter,
 
1602
                           COLUMN_COLOR, &color,
 
1603
                           -1);
 
1604
      }
 
1605
 
 
1606
    gtk_widget_destroy(GTK_WIDGET(dialog));
 
1607
  }}
 
1608
#line 1609 "lm-host-view.c"
 
1609
#undef __GOB_FUNCTION__
 
1610
 
 
1611
#line 663 "src/lm-host-view.gob"
 
1612
static void 
 
1613
lm_host_view_color_dialog_weak_notify_cb (gpointer data, GObject * former_dialog)
 
1614
{
 
1615
#line 1616 "lm-host-view.c"
 
1616
#define __GOB_FUNCTION__ "LM:Host:View::color_dialog_weak_notify_cb"
 
1617
{
 
1618
#line 665 "src/lm-host-view.gob"
 
1619
        
 
1620
    Self *self = data;
 
1621
 
 
1622
    selfp->color_dialog = NULL;
 
1623
 
 
1624
    gtk_tree_row_reference_free(selfp->color_dialog_row_reference);
 
1625
    selfp->color_dialog_row_reference = NULL;
 
1626
  }}
 
1627
#line 1628 "lm-host-view.c"
 
1628
#undef __GOB_FUNCTION__
 
1629
 
 
1630
#line 674 "src/lm-host-view.gob"
 
1631
static void 
 
1632
lm_host_view_editing_started_h (GtkCellRenderer * renderer, GtkCellEditable * editable, char * path, gpointer user_data)
 
1633
{
 
1634
#line 1635 "lm-host-view.c"
 
1635
#define __GOB_FUNCTION__ "LM:Host:View::editing_started_h"
 
1636
{
 
1637
#line 679 "src/lm-host-view.gob"
 
1638
        
 
1639
    Self *self = user_data;
 
1640
 
 
1641
    self_set_editing_host(self, TRUE);
 
1642
  }}
 
1643
#line 1644 "lm-host-view.c"
 
1644
#undef __GOB_FUNCTION__
 
1645
 
 
1646
#line 685 "src/lm-host-view.gob"
 
1647
static void 
 
1648
lm_host_view_editing_canceled_h (GtkCellRenderer * renderer, gpointer user_data)
 
1649
{
 
1650
#line 1651 "lm-host-view.c"
 
1651
#define __GOB_FUNCTION__ "LM:Host:View::editing_canceled_h"
 
1652
{
 
1653
#line 688 "src/lm-host-view.gob"
 
1654
        
 
1655
    Self *self = user_data;
 
1656
 
 
1657
    self_set_editing_host(self, FALSE);
 
1658
 
 
1659
    if (selfp->add_pending_count)
 
1660
      {
 
1661
        GtkTreeModel *model;
 
1662
 
 
1663
        selfp->add_pending_count--;
 
1664
        model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
1665
        self_store_remove(self, GTK_LIST_STORE(model), &selfp->add_pending_iter);
 
1666
      }
 
1667
  }}
 
1668
#line 1669 "lm-host-view.c"
 
1669
#undef __GOB_FUNCTION__
 
1670
 
 
1671
#line 703 "src/lm-host-view.gob"
 
1672
static void 
 
1673
lm_host_view_edited_h (GtkCellRendererText * renderer, const char * path_string, const char * new_text, gpointer user_data)
 
1674
{
 
1675
#line 1676 "lm-host-view.c"
 
1676
#define __GOB_FUNCTION__ "LM:Host:View::edited_h"
 
1677
{
 
1678
#line 708 "src/lm-host-view.gob"
 
1679
        
 
1680
    Self *self = user_data;
 
1681
    GtkTreeModel *model;
 
1682
    gboolean status;
 
1683
    GtkTreeIter iter;
 
1684
    LMHostFrontend *old_host;
 
1685
    LMHostFrontend *new_host;
 
1686
 
 
1687
    self_set_editing_host(self, FALSE);
 
1688
 
 
1689
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
1690
    status = gtk_tree_model_get_iter_from_string(model, &iter, path_string);
 
1691
    g_assert(status == TRUE);
 
1692
 
 
1693
    gtk_tree_model_get(model, &iter, COLUMN_HOST, &old_host, -1);
 
1694
 
 
1695
    if (old_host)
 
1696
      {
 
1697
        new_host = lm_host_frontend_new(selfp->applet, new_text, &old_host->color);
 
1698
        lm_applet_replace_host(selfp->applet, old_host, new_host);
 
1699
        g_object_unref(old_host);
 
1700
      }
 
1701
    else
 
1702
      {
 
1703
        new_host = lm_host_frontend_new(selfp->applet, new_text, NULL);
 
1704
        lm_applet_add_host(selfp->applet, new_host);
 
1705
      }
 
1706
 
 
1707
    gtk_list_store_set(GTK_LIST_STORE(model), &iter,
 
1708
                       COLUMN_HOST, new_host,
 
1709
                       COLUMN_COLOR, &new_host->color,
 
1710
                       COLUMN_NAME, LM_HOST(new_host)->name,
 
1711
                       -1);
 
1712
 
 
1713
    g_object_unref(new_host);
 
1714
 
 
1715
    if (selfp->add_pending_count)
 
1716
      selfp->add_pending_count--;
 
1717
  }}
 
1718
#line 1719 "lm-host-view.c"
 
1719
#undef __GOB_FUNCTION__
 
1720
 
 
1721
#line 748 "src/lm-host-view.gob"
 
1722
static void 
 
1723
lm_host_view_update_sensitivity (LMHostView * self)
 
1724
{
 
1725
#line 1726 "lm-host-view.c"
 
1726
#define __GOB_FUNCTION__ "LM:Host:View::update_sensitivity"
 
1727
#line 748 "src/lm-host-view.gob"
 
1728
        g_return_if_fail (self != NULL);
 
1729
#line 748 "src/lm-host-view.gob"
 
1730
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
1731
#line 1732 "lm-host-view.c"
 
1732
{
 
1733
#line 750 "src/lm-host-view.gob"
 
1734
        
 
1735
    GtkTreeModel *model;
 
1736
    GtkTreeSelection *selection;
 
1737
    GList *paths;
 
1738
    gboolean has_selection = FALSE;
 
1739
    gboolean has_prev = FALSE;
 
1740
    gboolean has_next = FALSE;
 
1741
    GtkTreeIter iter;
 
1742
    gboolean has_hosts;
 
1743
 
 
1744
    model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
 
1745
    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
 
1746
    paths = gtk_tree_selection_get_selected_rows(selection, NULL);
 
1747
 
 
1748
    if (paths)
 
1749
      {
 
1750
        GList *l;
 
1751
        gboolean status;
 
1752
 
 
1753
        has_selection = TRUE;
 
1754
 
 
1755
        /* has prev? */
 
1756
 
 
1757
        l = paths;
 
1758
        if (gtk_tree_path_prev(l->data))
 
1759
          {
 
1760
            gtk_tree_path_next(l->data); /* restore it */
 
1761
            has_prev = TRUE;
 
1762
          }
 
1763
 
 
1764
        /* has next? */
 
1765
 
 
1766
        l = g_list_last(paths);
 
1767
        status = gtk_tree_model_get_iter(model, &iter, l->data);
 
1768
        g_assert(status == TRUE);
 
1769
        if (gtk_tree_model_iter_next(model, &iter))
 
1770
          has_next = TRUE;
 
1771
 
 
1772
        /* cleanup */
 
1773
 
 
1774
        LM_LIST_FOREACH(l, paths)
 
1775
          gtk_tree_path_free(l->data);
 
1776
        g_list_free(paths);
 
1777
      }
 
1778
 
 
1779
    self_set_can_go_up(self, has_prev);
 
1780
    self_set_can_go_down(self, has_next);
 
1781
 
 
1782
    gtk_widget_set_sensitive(selfp->remove_item, has_selection);
 
1783
    gtk_widget_set_sensitive(selfp->cut_item, has_selection);
 
1784
    gtk_widget_set_sensitive(selfp->copy_item, has_selection);
 
1785
    gtk_widget_set_sensitive(selfp->up_item, has_prev);
 
1786
    gtk_widget_set_sensitive(selfp->down_item, has_next);
 
1787
 
 
1788
    has_hosts = gtk_tree_model_get_iter_first(model, &iter);
 
1789
    gtk_widget_set_sensitive(selfp->select_all_item, has_hosts);
 
1790
  }}
 
1791
#line 1792 "lm-host-view.c"
 
1792
#undef __GOB_FUNCTION__
 
1793
 
 
1794
#line 808 "src/lm-host-view.gob"
 
1795
static void 
 
1796
lm_host_view_popup_menu (LMHostView * self, int button, guint32 activate_time)
 
1797
{
 
1798
#line 1799 "lm-host-view.c"
 
1799
#define __GOB_FUNCTION__ "LM:Host:View::popup_menu"
 
1800
#line 808 "src/lm-host-view.gob"
 
1801
        g_return_if_fail (self != NULL);
 
1802
#line 808 "src/lm-host-view.gob"
 
1803
        g_return_if_fail (LM_IS_HOST_VIEW (self));
 
1804
#line 1805 "lm-host-view.c"
 
1805
{
 
1806
#line 810 "src/lm-host-view.gob"
 
1807
        
 
1808
    Self **self_box;
 
1809
 
 
1810
    gtk_widget_set_sensitive(selfp->paste_item, FALSE);
 
1811
 
 
1812
    /* do not crash if self is finalized before the request completes */
 
1813
    self_box = g_new(Self *, 1);
 
1814
    *self_box = self;
 
1815
    lm_add_weak_pointer(self_box);
 
1816
 
 
1817
    gtk_clipboard_request_targets(global_clipboard, self_popup_menu_targets_received_cb, self_box);
 
1818
 
 
1819
    gtk_menu_popup(GTK_MENU(selfp->menu), NULL, NULL, NULL, NULL, button, activate_time);
 
1820
  }}
 
1821
#line 1822 "lm-host-view.c"
 
1822
#undef __GOB_FUNCTION__
 
1823
 
 
1824
#line 825 "src/lm-host-view.gob"
 
1825
static void 
 
1826
lm_host_view_popup_menu_targets_received_cb (GtkClipboard * clipboard, GdkAtom * atoms, int n_atoms, gpointer data)
 
1827
{
 
1828
#line 1829 "lm-host-view.c"
 
1829
#define __GOB_FUNCTION__ "LM:Host:View::popup_menu_targets_received_cb"
 
1830
{
 
1831
#line 830 "src/lm-host-view.gob"
 
1832
        
 
1833
    Self **self_box = data;
 
1834
    Self *self = *self_box;
 
1835
 
 
1836
    if (self)
 
1837
      {
 
1838
        if (atoms)
 
1839
          gtk_widget_set_sensitive(selfp->paste_item, self_can_paste(atoms, n_atoms));
 
1840
 
 
1841
        lm_remove_weak_pointer(self_box);
 
1842
      }
 
1843
 
 
1844
    g_free(self_box);
 
1845
  }}
 
1846
#line 1847 "lm-host-view.c"
 
1847
#undef __GOB_FUNCTION__
 
1848
 
 
1849
#line 845 "src/lm-host-view.gob"
 
1850
static gboolean 
 
1851
lm_host_view_can_paste (GdkAtom * atoms, int n_atoms)
 
1852
{
 
1853
#line 1854 "lm-host-view.c"
 
1854
#define __GOB_FUNCTION__ "LM:Host:View::can_paste"
 
1855
{
 
1856
#line 847 "src/lm-host-view.gob"
 
1857
        
 
1858
    int i;
 
1859
 
 
1860
    for (i = 0; i < n_atoms; i++)
 
1861
      if (atoms[i] == CLIPBOARD_TARGET_NATIVE)
 
1862
        return TRUE;
 
1863
 
 
1864
    return gtk_targets_include_text(atoms, n_atoms);
 
1865
  }}
 
1866
#line 1867 "lm-host-view.c"
 
1867
#undef __GOB_FUNCTION__
 
1868
 
 
1869
#line 857 "src/lm-host-view.gob"
 
1870
static gboolean 
 
1871
lm_host_view_popup_menu_h (GtkWidget * widget, gpointer user_data)
 
1872
{
 
1873
#line 1874 "lm-host-view.c"
 
1874
#define __GOB_FUNCTION__ "LM:Host:View::popup_menu_h"
 
1875
{
 
1876
#line 859 "src/lm-host-view.gob"
 
1877
        
 
1878
    Self *self = SELF(widget);
 
1879
 
 
1880
    self_popup_menu(self, 0, gtk_get_current_event_time());
 
1881
    gtk_menu_shell_select_first(GTK_MENU_SHELL(selfp->menu), FALSE);
 
1882
 
 
1883
    return TRUE;                /* a menu was activated */
 
1884
  }}
 
1885
#line 1886 "lm-host-view.c"
 
1886
#undef __GOB_FUNCTION__
 
1887
 
 
1888
#line 868 "src/lm-host-view.gob"
 
1889
static gboolean 
 
1890
lm_host_view_button_press_event_h (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
 
1891
{
 
1892
#line 1893 "lm-host-view.c"
 
1893
#define __GOB_FUNCTION__ "LM:Host:View::button_press_event_h"
 
1894
{
 
1895
#line 872 "src/lm-host-view.gob"
 
1896
        
 
1897
    if (event->button == 3)
 
1898
      self_popup_menu(SELF(widget), event->button, event->time);
 
1899
 
 
1900
    return FALSE;               /* propagate event */
 
1901
  }}
 
1902
#line 1903 "lm-host-view.c"
 
1903
#undef __GOB_FUNCTION__
 
1904
 
 
1905
#line 879 "src/lm-host-view.gob"
 
1906
static void 
 
1907
lm_host_view_select_all_activate_h (GtkMenuItem * item, gpointer user_data)
 
1908
{
 
1909
#line 1910 "lm-host-view.c"
 
1910
#define __GOB_FUNCTION__ "LM:Host:View::select_all_activate_h"
 
1911
{
 
1912
#line 881 "src/lm-host-view.gob"
 
1913
        
 
1914
    Self *self = user_data;
 
1915
    GtkTreeSelection *selection;
 
1916
 
 
1917
    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
 
1918
    gtk_tree_selection_select_all(selection);
 
1919
  }}
 
1920
#line 1921 "lm-host-view.c"
 
1921
#undef __GOB_FUNCTION__
 
1922
 
 
1923
#line 889 "src/lm-host-view.gob"
 
1924
static void 
 
1925
lm_host_view_up_activate_h (GtkMenuItem * item, gpointer user_data)
 
1926
{
 
1927
#line 1928 "lm-host-view.c"
 
1928
#define __GOB_FUNCTION__ "LM:Host:View::up_activate_h"
 
1929
{
 
1930
#line 891 "src/lm-host-view.gob"
 
1931
        
 
1932
    Self *self = user_data;
 
1933
    self_activate_move(self, -1);
 
1934
  }}
 
1935
#line 1936 "lm-host-view.c"
 
1936
#undef __GOB_FUNCTION__
 
1937
 
 
1938
#line 896 "src/lm-host-view.gob"
 
1939
static void 
 
1940
lm_host_view_down_activate_h (GtkMenuItem * item, gpointer user_data)
 
1941
{
 
1942
#line 1943 "lm-host-view.c"
 
1943
#define __GOB_FUNCTION__ "LM:Host:View::down_activate_h"
 
1944
{
 
1945
#line 898 "src/lm-host-view.gob"
 
1946
        
 
1947
    Self *self = user_data;
 
1948
    self_activate_move(self, +1);
 
1949
  }}
 
1950
#line 1951 "lm-host-view.c"
 
1951
#undef __GOB_FUNCTION__
 
1952
 
 
1953
#line 903 "src/lm-host-view.gob"
 
1954
static gboolean 
 
1955
lm_host_view_search_equal_cb (GtkTreeModel * model, int column, const char * key, GtkTreeIter * iter, gpointer search_data)
 
1956
{
 
1957
#line 1958 "lm-host-view.c"
 
1958
#define __GOB_FUNCTION__ "LM:Host:View::search_equal_cb"
 
1959
{
 
1960
#line 909 "src/lm-host-view.gob"
 
1961
        
 
1962
    gboolean status = TRUE;
 
1963
    GValue value = { 0, };
 
1964
    GValue transformed = { 0, };
 
1965
    const char *str;
 
1966
    char *normalized_string;
 
1967
    char *normalized_key;
 
1968
 
 
1969
    /*
 
1970
     * The stock gtk_tree_view_search_equal_func() only searches the
 
1971
     * start of the string, using strncmp(). We use strstr(), to
 
1972
     * search anywhere inside the string.
 
1973
     */
 
1974
 
 
1975
    gtk_tree_model_get_value(model, iter, column, &value);
 
1976
 
 
1977
    g_value_init(&transformed, G_TYPE_STRING);
 
1978
 
 
1979
    if (! g_value_transform(&value, &transformed))
 
1980
      {
 
1981
        g_value_unset(&value);
 
1982
        return TRUE;
 
1983
      }
 
1984
 
 
1985
    g_value_unset(&value);
 
1986
 
 
1987
    str = g_value_get_string(&transformed);
 
1988
    if (! str)
 
1989
      {
 
1990
        g_value_unset(&transformed);
 
1991
        return TRUE;
 
1992
      }
 
1993
 
 
1994
    normalized_string = g_utf8_normalize(str, -1, G_NORMALIZE_ALL);
 
1995
    normalized_key = g_utf8_normalize(key, -1, G_NORMALIZE_ALL);
 
1996
 
 
1997
    if (normalized_string && normalized_key)
 
1998
      {
 
1999
        char *case_normalized_string;
 
2000
        char *case_normalized_key;
 
2001
 
 
2002
        case_normalized_string = g_utf8_casefold(normalized_string, -1);
 
2003
        case_normalized_key = g_utf8_casefold(normalized_key, -1);
 
2004
 
 
2005
        if (strstr(case_normalized_string, case_normalized_key))
 
2006
          status = FALSE;
 
2007
 
 
2008
        g_free(case_normalized_string);
 
2009
        g_free(case_normalized_key);
 
2010
      }
 
2011
 
 
2012
    g_value_unset (&transformed);
 
2013
    g_free(normalized_key);
 
2014
    g_free(normalized_string);
 
2015
 
 
2016
    return status;
 
2017
  }}
 
2018
#line 2019 "lm-host-view.c"
 
2019
#undef __GOB_FUNCTION__
 
2020
 
 
2021
#line 967 "src/lm-host-view.gob"
 
2022
GtkWidget * 
 
2023
lm_host_view_new (LMApplet * applet)
 
2024
{
 
2025
#line 2026 "lm-host-view.c"
 
2026
#define __GOB_FUNCTION__ "LM:Host:View::new"
 
2027
#line 967 "src/lm-host-view.gob"
 
2028
        g_return_val_if_fail (applet != NULL, (GtkWidget * )0);
 
2029
#line 967 "src/lm-host-view.gob"
 
2030
        g_return_val_if_fail (LM_IS_APPLET (applet), (GtkWidget * )0);
 
2031
#line 2032 "lm-host-view.c"
 
2032
{
 
2033
#line 969 "src/lm-host-view.gob"
 
2034
        
 
2035
    return GTK_WIDGET(GET_NEW_VARG(LM_HOST_VIEW_PROP_APPLET(applet), NULL));
 
2036
  }}
 
2037
#line 2038 "lm-host-view.c"
 
2038
#undef __GOB_FUNCTION__