~ubuntu-branches/ubuntu/maverick/awn-extras-applets/maverick

« back to all changes in this revision

Viewing changes to applets/maintained/garbage/applet.c

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-08-29 14:29:52 UTC
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20100829142952-rhvuetyms9bv5uu7
Tags: upstream-0.4.0+bzr1372
Import upstream version 0.4.0+bzr1372

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* applet.c generated by valac, the Vala compiler
 
1
/* applet.c generated by valac 0.9.7, the Vala compiler
2
2
 * generated from applet.vala, do not modify */
3
3
 
4
4
/*
25
25
 
26
26
#include <glib.h>
27
27
#include <glib-object.h>
28
 
#include <config.h>
29
28
#include <stdlib.h>
30
29
#include <string.h>
 
30
#include <config.h>
31
31
#include <libawn/libawn.h>
32
32
#include <libdesktop-agnostic/vfs.h>
33
33
#include <libdesktop-agnostic/config.h>
91
91
static gpointer garbage_applet_parent_class = NULL;
92
92
 
93
93
#define not_used APPLETSDIR
94
 
GType garbage_applet_get_type (void);
95
 
GType garbage_prefs_get_type (void);
 
94
GType garbage_applet_get_type (void) G_GNUC_CONST;
 
95
GType garbage_prefs_get_type (void) G_GNUC_CONST;
96
96
#define GARBAGE_APPLET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_GARBAGE_APPLET, GarbageAppletPrivate))
97
97
enum  {
98
98
        GARBAGE_APPLET_DUMMY_PROPERTY,
99
99
        GARBAGE_APPLET_SHOW_COUNT,
100
100
        GARBAGE_APPLET_CONFIRM_EMPTY
101
101
};
 
102
GarbageApplet* garbage_applet_new (const char* canonical_name, const char* uid, gint panel_id);
 
103
GarbageApplet* garbage_applet_construct (GType object_type, const char* canonical_name, const char* uid, gint panel_id);
102
104
static void garbage_applet_on_prop_changed (GarbageApplet* self, GParamSpec* pspec);
103
105
static void _garbage_applet_on_prop_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
104
106
static void garbage_applet_render_applet_icon (GarbageApplet* self);
105
 
GarbageApplet* garbage_applet_new (const char* canonical_name, const char* uid, gint panel_id);
106
 
GarbageApplet* garbage_applet_construct (GType object_type, const char* canonical_name, const char* uid, gint panel_id);
 
107
static gboolean garbage_applet_on_map_event (GarbageApplet* self, GdkEvent* evt);
107
108
static gboolean garbage_applet_on_drag_motion (GarbageApplet* self, GdkDragContext* context, gint x, gint y, guint time);
108
109
static gboolean _garbage_applet_on_drag_motion_gtk_widget_drag_motion (GtkWidget* _sender, GdkDragContext* context, gint x, gint y, guint time_, gpointer self);
109
110
static void garbage_applet_on_drag_leave (GarbageApplet* self, GdkDragContext* context, guint time);
110
111
static void _garbage_applet_on_drag_leave_gtk_widget_drag_leave (GtkWidget* _sender, GdkDragContext* context, guint time_, gpointer self);
111
112
static void garbage_applet_on_drag_data_received (GarbageApplet* self, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint info, guint time);
112
113
static void _garbage_applet_on_drag_data_received_gtk_widget_drag_data_received (GtkWidget* _sender, GdkDragContext* context, gint x, gint y, GtkSelectionData* selection_data, guint info, guint time_, gpointer self);
113
 
static gboolean garbage_applet_on_map_event (GarbageApplet* self, GdkEvent* evt);
114
114
static void garbage_applet_show_error_message (GarbageApplet* self, const char* msg);
115
115
gboolean garbage_applet_get_show_count (GarbageApplet* self);
116
116
static void garbage_applet_on_clicked (GarbageApplet* self);
 
117
static void garbage_applet_on_context_menu_popup (GarbageApplet* self, GdkEventButton* evt);
117
118
static void garbage_applet_on_menu_empty_activate (GarbageApplet* self);
118
119
static void _garbage_applet_on_menu_empty_activate_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
119
120
static void garbage_applet_on_menu_prefs_activate (GarbageApplet* self);
120
121
static void _garbage_applet_on_menu_prefs_activate_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
121
 
static void garbage_applet_on_context_menu_popup (GarbageApplet* self, GdkEventButton* evt);
122
122
gboolean garbage_applet_get_confirm_empty (GarbageApplet* self);
123
123
GarbagePrefs* garbage_prefs_new (GarbageApplet* applet);
124
124
GarbagePrefs* garbage_prefs_construct (GType object_type, GarbageApplet* applet);
152
152
 
153
153
 
154
154
GarbageApplet* garbage_applet_construct (GType object_type, const char* canonical_name, const char* uid, gint panel_id) {
155
 
        GError * _inner_error_;
156
 
        GParameter * __params;
157
 
        GParameter * __params_it;
158
155
        GarbageApplet * self;
159
156
        AwnIcon* _tmp0_;
160
157
        DesktopAgnosticConfigClient* _tmp1_;
161
158
        DesktopAgnosticConfigClient* _tmp2_;
 
159
        GError * _inner_error_ = NULL;
162
160
        g_return_val_if_fail (canonical_name != NULL, NULL);
163
161
        g_return_val_if_fail (uid != NULL, NULL);
164
 
        _inner_error_ = NULL;
165
 
        __params = g_new0 (GParameter, 3);
166
 
        __params_it = __params;
167
 
        __params_it->name = "canonical-name";
168
 
        g_value_init (&__params_it->value, G_TYPE_STRING);
169
 
        g_value_set_string (&__params_it->value, canonical_name);
170
 
        __params_it++;
171
 
        __params_it->name = "uid";
172
 
        g_value_init (&__params_it->value, G_TYPE_STRING);
173
 
        g_value_set_string (&__params_it->value, uid);
174
 
        __params_it++;
175
 
        __params_it->name = "panel-id";
176
 
        g_value_init (&__params_it->value, G_TYPE_INT);
177
 
        g_value_set_int (&__params_it->value, panel_id);
178
 
        __params_it++;
179
 
        self = g_object_newv (object_type, __params_it - __params, __params);
 
162
        self = (GarbageApplet*) g_object_new (object_type, "canonical-name", canonical_name, "uid", uid, "panel-id", panel_id, NULL);
180
163
        g_object_set ((GObject*) (_tmp0_ = awn_applet_simple_get_icon ((AwnAppletSimple*) self), AWN_IS_THEMED_ICON (_tmp0_) ? ((AwnThemedIcon*) _tmp0_) : NULL), "drag-and-drop", FALSE, NULL);
181
164
        _tmp1_ = awn_config_get_default_for_applet ((AwnApplet*) self, &_inner_error_);
182
165
        if (_inner_error_ != NULL) {
224
207
                g_clear_error (&_inner_error_);
225
208
                return NULL;
226
209
        }
227
 
        while (__params_it > __params) {
228
 
                --__params_it;
229
 
                g_value_unset (&__params_it->value);
230
 
        }
231
 
        g_free (__params);
232
210
        return self;
233
211
}
234
212
 
246
224
 
247
225
 
248
226
static gboolean _garbage_applet_on_drag_motion_gtk_widget_drag_motion (GtkWidget* _sender, GdkDragContext* context, gint x, gint y, guint time_, gpointer self) {
249
 
        return garbage_applet_on_drag_motion (self, context, x, y, time_);
 
227
        gboolean result;
 
228
        result = garbage_applet_on_drag_motion (self, context, x, y, time_);
 
229
        return result;
250
230
}
251
231
 
252
232
 
293
273
        char* plural;
294
274
        gboolean _tmp2_ = FALSE;
295
275
        char* _tmp8_;
 
276
        char* _tmp9_ = NULL;
 
277
        char* _tmp10_;
296
278
        char* _tmp11_;
297
 
        char* _tmp10_;
298
 
        char* _tmp9_ = NULL;
299
279
        g_return_if_fail (self != NULL);
300
280
        plural = NULL;
301
281
        file_count = desktop_agnostic_vfs_trash_get_file_count (self->trash);
362
342
 
363
343
 
364
344
static void garbage_applet_on_clicked (GarbageApplet* self) {
365
 
        GError * _inner_error_;
 
345
        GError * _inner_error_ = NULL;
366
346
        g_return_if_fail (self != NULL);
367
 
        _inner_error_ = NULL;
368
347
        {
 
348
                gint argv_length1;
 
349
                gint _argv_size_;
369
350
                char** _tmp1_;
370
 
                gint _argv_size_;
371
 
                gint argv_length1;
372
351
                char** _tmp0_ = NULL;
373
352
                char** argv;
374
353
                argv = (_tmp1_ = (_tmp0_ = g_new0 (char*, 2 + 1), _tmp0_[0] = g_strdup ("xdg-open"), _tmp0_[1] = g_strdup ("trash:"), _tmp0_), argv_length1 = 2, _argv_size_ = argv_length1, _tmp1_);
390
369
                        char* _tmp2_;
391
370
                        msg = NULL;
392
371
                        msg = (_tmp2_ = g_strdup_printf (_ ("Could not open the trash folder with your file manager: %s"), err->message), _g_free0 (msg), _tmp2_);
 
372
                        _g_free0 (msg);
393
373
                        _g_error_free0 (err);
394
 
                        _g_free0 (msg);
395
374
                }
396
375
        }
397
376
        __finally1:
420
399
        if (self->priv->menu == NULL) {
421
400
                GtkImageMenuItem* prefs_item;
422
401
                GtkWidget* about_item;
 
402
                GtkWidget* _tmp0_;
423
403
                GtkMenu* _tmp1_;
424
 
                GtkWidget* _tmp0_;
425
404
                GtkMenuItem* _tmp2_;
426
405
                GtkImageMenuItem* _tmp3_;
427
406
                GtkWidget* _tmp4_;
441
420
                about_item = (_tmp4_ = _g_object_ref0 (awn_applet_create_about_item_simple ((AwnApplet*) self, "Copyright © 2009 Mark Lee <avant-wn@lazymalevolence.com>", AWN_APPLET_LICENSE_GPLV2, VERSION)), _g_object_unref0 (about_item), _tmp4_);
442
421
                gtk_widget_show (about_item);
443
422
                gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) (_tmp5_ = about_item, GTK_IS_MENU_ITEM (_tmp5_) ? ((GtkMenuItem*) _tmp5_) : NULL));
 
423
                _g_object_unref0 (about_item);
444
424
                _g_object_unref0 (prefs_item);
445
 
                _g_object_unref0 (about_item);
446
425
        }
447
426
        ctx_menu = GTK_MENU (self->priv->menu);
448
427
        gtk_menu_set_screen (ctx_menu, NULL);
463
442
                response = gtk_dialog_run ((GtkDialog*) dialog);
464
443
                gtk_object_destroy ((GtkObject*) dialog);
465
444
                do_empty = response == GTK_RESPONSE_YES;
 
445
                _g_object_unref0 (dialog);
466
446
                _g_free0 (msg);
467
 
                _g_object_unref0 (dialog);
468
447
        } else {
469
448
                do_empty = TRUE;
470
449
        }
534
513
 
535
514
 
536
515
static void garbage_applet_on_drag_data_received (GarbageApplet* self, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint info, guint time) {
537
 
        GError * _inner_error_;
538
516
        GSList* file_uris;
539
517
        gboolean _tmp0_ = FALSE;
 
518
        GError * _inner_error_ = NULL;
540
519
        g_return_if_fail (self != NULL);
541
520
        g_return_if_fail (context != NULL);
542
521
        g_return_if_fail (data != NULL);
543
 
        _inner_error_ = NULL;
544
522
        file_uris = NULL;
545
523
        if (data == NULL) {
546
524
                _tmp0_ = TRUE;
604
582
                        char* msg;
605
583
                        msg = g_strdup_printf (_ ("Could not send the dragged file(s) to the trash: %s"), err->message);
606
584
                        garbage_applet_show_error_message (self, msg);
 
585
                        _g_free0 (msg);
607
586
                        _g_error_free0 (err);
608
 
                        _g_free0 (msg);
609
587
                }
610
588
        }
611
589
        __finally2:
657
635
 
658
636
 
659
637
static gboolean _garbage_applet_on_map_event_gtk_widget_map_event (GtkWidget* _sender, GdkEvent* event, gpointer self) {
660
 
        return garbage_applet_on_map_event (self, event);
 
638
        gboolean result;
 
639
        result = garbage_applet_on_map_event (self, event);
 
640
        return result;
661
641
}
662
642
 
663
643