Back to index

libappindicator  12.10.0
simple-client-vala.c
Go to the documentation of this file.
00001 /* simple-client-vala.c generated by valac 0.16.1, the Vala compiler
00002  * generated from simple-client-vala.vala, do not modify */
00003 
00004 /*
00005 A small piece of sample code demonstrating a very simple application
00006 with an indicator.
00007 
00008 Copyright 2011 Canonical Ltd.
00009 
00010 Authors:
00011     Marco Trevisan <mail@3v1n0.net>
00012 
00013 This program is free software: you can redistribute it and/or modify it 
00014 under the terms of the GNU General Public License version 3, as published 
00015 by the Free Software Foundation.
00016 
00017 This program is distributed in the hope that it will be useful, but 
00018 WITHOUT ANY WARRANTY; without even the implied warranties of 
00019 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
00020 PURPOSE.  See the GNU General Public License for more details.
00021 
00022 You should have received a copy of the GNU General Public License along 
00023 with this program.  If not, see <http://www.gnu.org/licenses/>.
00024 */
00025 
00026 #include <glib.h>
00027 #include <glib-object.h>
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include <gtk/gtk.h>
00031 
00032 #include <gdk/gdk.h>
00033 #include <gobject/gvaluecollector.h>
00034 
00035 
00036 #define TYPE_SIMPLE_CLIENT (simple_client_get_type ())
00037 #define SIMPLE_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SIMPLE_CLIENT, SimpleClient))
00038 #define SIMPLE_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SIMPLE_CLIENT, SimpleClientClass))
00039 #define IS_SIMPLE_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SIMPLE_CLIENT))
00040 #define IS_SIMPLE_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SIMPLE_CLIENT))
00041 #define SIMPLE_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SIMPLE_CLIENT, SimpleClientClass))
00042 
00043 typedef struct _SimpleClient SimpleClient;
00044 typedef struct _SimpleClientClass SimpleClientClass;
00045 #define _simple_client_unref0(var) ((var == NULL) ? NULL : (var = (simple_client_unref (var), NULL)))
00046 typedef struct _SimpleClientPrivate SimpleClientPrivate;
00047 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
00048 typedef struct _Block1Data Block1Data;
00049 typedef struct _Block2Data Block2Data;
00050 #define _g_free0(var) (var = (g_free (var), NULL))
00051 #define __g_slist_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_object_unref0_ (var), NULL)))
00052 typedef struct _ParamSpecSimpleClient ParamSpecSimpleClient;
00053 
00054 struct _SimpleClient {
00055        GTypeInstance parent_instance;
00056        volatile int ref_count;
00057        SimpleClientPrivate * priv;
00058 };
00059 
00060 struct _SimpleClientClass {
00061        GTypeClass parent_class;
00062        void (*finalize) (SimpleClient *self);
00063 };
00064 
00065 struct _SimpleClientPrivate {
00066        GtkMenu* menu;
00067        AppIndicator* ci;
00068        gint percentage;
00069        gboolean active;
00070        gboolean can_haz_label;
00071 };
00072 
00073 struct _Block1Data {
00074        int _ref_count_;
00075        SimpleClient * self;
00076        GtkMenuItem* prev_mi;
00077 };
00078 
00079 struct _Block2Data {
00080        int _ref_count_;
00081        SimpleClient * self;
00082        GtkMenuItem* submenu;
00083        GtkImageMenuItem* imgitem;
00084        GtkMenuItem* att;
00085        GtkMenuItem* show;
00086        GtkCheckMenuItem* icon;
00087 };
00088 
00089 struct _ParamSpecSimpleClient {
00090        GParamSpec parent_instance;
00091 };
00092 
00093 
00094 static gpointer simple_client_parent_class = NULL;
00095 
00096 gint _vala_main (gchar** args, int args_length1);
00097 SimpleClient* simple_client_new (gchar** args, int args_length1);
00098 SimpleClient* simple_client_construct (GType object_type, gchar** args, int args_length1);
00099 gpointer simple_client_ref (gpointer instance);
00100 void simple_client_unref (gpointer instance);
00101 GParamSpec* param_spec_simple_client (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
00102 void value_set_simple_client (GValue* value, gpointer v_object);
00103 void value_take_simple_client (GValue* value, gpointer v_object);
00104 gpointer value_get_simple_client (const GValue* value);
00105 GType simple_client_get_type (void) G_GNUC_CONST;
00106 void simple_client_run (SimpleClient* self);
00107 #define SIMPLE_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_SIMPLE_CLIENT, SimpleClientPrivate))
00108 enum  {
00109        SIMPLE_CLIENT_DUMMY_PROPERTY
00110 };
00111 static void simple_client_toggle_sensitivity (SimpleClient* self, GtkWidget* widget);
00112 static void simple_client_append_submenu (SimpleClient* self, GtkMenuItem* item);
00113 static Block1Data* block1_data_ref (Block1Data* _data1_);
00114 static void block1_data_unref (void * _userdata_);
00115 static void __lambda2_ (SimpleClient* self);
00116 static void ___lambda2__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00117 static void __lambda3_ (Block1Data* _data1_);
00118 static void ___lambda3__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00119 static void __lambda4_ (SimpleClient* self);
00120 static void ___lambda4__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00121 static void __lambda5_ (SimpleClient* self);
00122 static void ___lambda5__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00123 static void simple_client_label_toggle (SimpleClient* self, GtkMenuItem* item);
00124 static Block2Data* block2_data_ref (Block2Data* _data2_);
00125 static void block2_data_unref (void * _userdata_);
00126 static void __lambda6_ (SimpleClient* self, gint delta, GdkScrollDirection direction);
00127 const gchar* gdk_scroll_direction_to_string (GdkScrollDirection self);
00128 static void ___lambda6__app_indicator_scroll_event (AppIndicator* _sender, gint delta, GdkScrollDirection direction, gpointer self);
00129 static gboolean __lambda7_ (SimpleClient* self);
00130 static gboolean ___lambda7__gsource_func (gpointer self);
00131 static void __lambda8_ (SimpleClient* self);
00132 static void ___lambda8__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00133 static void _g_object_unref0_ (gpointer var);
00134 static void _g_slist_free__g_object_unref0_ (GSList* self);
00135 static void __lambda9_ (SimpleClient* self);
00136 static void ___lambda9__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00137 static void __lambda10_ (Block2Data* _data2_);
00138 static void ___lambda10__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00139 static void __lambda11_ (Block2Data* _data2_);
00140 static void ___lambda11__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00141 static void __lambda12_ (Block2Data* _data2_);
00142 static void ___lambda12__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00143 static void __lambda13_ (Block2Data* _data2_);
00144 static void ___lambda13__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00145 static void __lambda14_ (Block2Data* _data2_);
00146 static void ___lambda14__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self);
00147 static void simple_client_finalize (SimpleClient* obj);
00148 
00149 
00150 gint _vala_main (gchar** args, int args_length1) {
00151        gint result = 0;
00152        gchar** _tmp0_;
00153        gint _tmp0__length1;
00154        SimpleClient* _tmp1_;
00155        SimpleClient* sc;
00156        _tmp0_ = args;
00157        _tmp0__length1 = args_length1;
00158        _tmp1_ = simple_client_new (_tmp0_, _tmp0__length1);
00159        sc = _tmp1_;
00160        simple_client_run (sc);
00161        result = 0;
00162        _simple_client_unref0 (sc);
00163        return result;
00164 }
00165 
00166 
00167 int main (int argc, char ** argv) {
00168        g_type_init ();
00169        return _vala_main (argv, argc);
00170 }
00171 
00172 
00173 SimpleClient* simple_client_construct (GType object_type, gchar** args, int args_length1) {
00174        SimpleClient* self = NULL;
00175        AppIndicator* _tmp0_;
00176        AppIndicator* _tmp1_;
00177        AppIndicator* _tmp2_;
00178        AppIndicator* _tmp3_;
00179        AppIndicator* _tmp4_;
00180        self = (SimpleClient*) g_type_create_instance (object_type);
00181        gtk_init (&args_length1, &args);
00182        _tmp0_ = app_indicator_new ("example-simple-client", "indicator-messages", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
00183        _g_object_unref0 (self->priv->ci);
00184        self->priv->ci = _tmp0_;
00185        _tmp1_ = self->priv->ci;
00186        app_indicator_set_status (_tmp1_, APP_INDICATOR_STATUS_ACTIVE);
00187        _tmp2_ = self->priv->ci;
00188        app_indicator_set_attention_icon (_tmp2_, "indicator-messages-new");
00189        _tmp3_ = self->priv->ci;
00190        app_indicator_set_label (_tmp3_, "1%", "100%");
00191        _tmp4_ = self->priv->ci;
00192        app_indicator_set_title (_tmp4_, "Test Indicator (vala)");
00193        self->priv->active = TRUE;
00194        self->priv->can_haz_label = TRUE;
00195        return self;
00196 }
00197 
00198 
00199 SimpleClient* simple_client_new (gchar** args, int args_length1) {
00200        return simple_client_construct (TYPE_SIMPLE_CLIENT, args, args_length1);
00201 }
00202 
00203 
00204 static void simple_client_toggle_sensitivity (SimpleClient* self, GtkWidget* widget) {
00205        GtkWidget* _tmp0_;
00206        GtkWidget* _tmp1_;
00207        gboolean _tmp2_ = FALSE;
00208        g_return_if_fail (self != NULL);
00209        g_return_if_fail (widget != NULL);
00210        _tmp0_ = widget;
00211        _tmp1_ = widget;
00212        _tmp2_ = gtk_widget_is_sensitive (_tmp1_);
00213        gtk_widget_set_sensitive (_tmp0_, !_tmp2_);
00214 }
00215 
00216 
00217 static Block1Data* block1_data_ref (Block1Data* _data1_) {
00218        g_atomic_int_inc (&_data1_->_ref_count_);
00219        return _data1_;
00220 }
00221 
00222 
00223 static void block1_data_unref (void * _userdata_) {
00224        Block1Data* _data1_;
00225        _data1_ = (Block1Data*) _userdata_;
00226        if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
00227               SimpleClient * self;
00228               self = _data1_->self;
00229               _g_object_unref0 (_data1_->prev_mi);
00230               _simple_client_unref0 (self);
00231               g_slice_free (Block1Data, _data1_);
00232        }
00233 }
00234 
00235 
00236 static void __lambda2_ (SimpleClient* self) {
00237        g_print ("Sub1\n");
00238 }
00239 
00240 
00241 static void ___lambda2__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00242        __lambda2_ (self);
00243 }
00244 
00245 
00246 static gpointer _g_object_ref0 (gpointer self) {
00247        return self ? g_object_ref (self) : NULL;
00248 }
00249 
00250 
00251 static void __lambda3_ (Block1Data* _data1_) {
00252        SimpleClient * self;
00253        self = _data1_->self;
00254        simple_client_toggle_sensitivity (self, (GtkWidget*) _data1_->prev_mi);
00255 }
00256 
00257 
00258 static void ___lambda3__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00259        __lambda3_ (self);
00260 }
00261 
00262 
00263 static void __lambda4_ (SimpleClient* self) {
00264        g_print ("Sub3\n");
00265 }
00266 
00267 
00268 static void ___lambda4__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00269        __lambda4_ (self);
00270 }
00271 
00272 
00273 static void __lambda5_ (SimpleClient* self) {
00274        AppIndicator* _tmp0_;
00275        AppIndicatorStatus _tmp1_ = 0;
00276        _tmp0_ = self->priv->ci;
00277        _tmp1_ = app_indicator_get_status (_tmp0_);
00278        if (_tmp1_ == APP_INDICATOR_STATUS_ATTENTION) {
00279               AppIndicator* _tmp2_;
00280               _tmp2_ = self->priv->ci;
00281               app_indicator_set_status (_tmp2_, APP_INDICATOR_STATUS_ACTIVE);
00282        } else {
00283               AppIndicator* _tmp3_;
00284               _tmp3_ = self->priv->ci;
00285               app_indicator_set_status (_tmp3_, APP_INDICATOR_STATUS_ATTENTION);
00286        }
00287 }
00288 
00289 
00290 static void ___lambda5__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00291        __lambda5_ (self);
00292 }
00293 
00294 
00295 static void simple_client_append_submenu (SimpleClient* self, GtkMenuItem* item) {
00296        Block1Data* _data1_;
00297        GtkMenu* _tmp0_;
00298        GtkMenu* _tmp1_;
00299        GtkMenu* menu;
00300        GtkMenuItem* mi = NULL;
00301        GtkMenuItem* _tmp2_;
00302        GtkMenuItem* _tmp3_;
00303        GtkMenuItem* _tmp4_;
00304        GtkMenuItem* _tmp5_;
00305        GtkMenuItem* _tmp6_;
00306        GtkMenuItem* _tmp7_;
00307        GtkMenuItem* _tmp8_;
00308        GtkMenuItem* _tmp9_;
00309        GtkMenuItem* _tmp10_;
00310        GtkMenuItem* _tmp11_;
00311        GtkMenuItem* _tmp12_;
00312        GtkMenuItem* _tmp13_;
00313        GtkMenuItem* _tmp14_;
00314        GtkMenuItem* _tmp15_;
00315        GtkMenuItem* _tmp16_;
00316        GtkMenuItem* _tmp17_;
00317        GtkMenuItem* _tmp18_;
00318        GtkMenuItem* _tmp19_;
00319        AppIndicator* _tmp20_;
00320        GtkMenuItem* _tmp21_;
00321        GtkMenuItem* _tmp22_;
00322        g_return_if_fail (self != NULL);
00323        g_return_if_fail (item != NULL);
00324        _data1_ = g_slice_new0 (Block1Data);
00325        _data1_->_ref_count_ = 1;
00326        _data1_->self = simple_client_ref (self);
00327        _tmp0_ = (GtkMenu*) gtk_menu_new ();
00328        _tmp1_ = g_object_ref_sink (_tmp0_);
00329        menu = _tmp1_;
00330        _tmp2_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Sub 1");
00331        _tmp3_ = g_object_ref_sink (_tmp2_);
00332        _g_object_unref0 (mi);
00333        mi = _tmp3_;
00334        _tmp4_ = mi;
00335        gtk_menu_shell_append ((GtkMenuShell*) menu, (GtkWidget*) _tmp4_);
00336        _tmp5_ = mi;
00337        g_signal_connect (_tmp5_, "activate", (GCallback) ___lambda2__gtk_menu_item_activate, self);
00338        _tmp6_ = mi;
00339        _tmp7_ = _g_object_ref0 (_tmp6_);
00340        _data1_->prev_mi = _tmp7_;
00341        _tmp8_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Sub 2");
00342        _tmp9_ = g_object_ref_sink (_tmp8_);
00343        _g_object_unref0 (mi);
00344        mi = _tmp9_;
00345        _tmp10_ = mi;
00346        gtk_menu_shell_append ((GtkMenuShell*) menu, (GtkWidget*) _tmp10_);
00347        _tmp11_ = mi;
00348        g_signal_connect_data (_tmp11_, "activate", (GCallback) ___lambda3__gtk_menu_item_activate, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
00349        _tmp12_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Sub 3");
00350        _tmp13_ = g_object_ref_sink (_tmp12_);
00351        _g_object_unref0 (mi);
00352        mi = _tmp13_;
00353        _tmp14_ = mi;
00354        gtk_menu_shell_append ((GtkMenuShell*) menu, (GtkWidget*) _tmp14_);
00355        _tmp15_ = mi;
00356        g_signal_connect (_tmp15_, "activate", (GCallback) ___lambda4__gtk_menu_item_activate, self);
00357        _tmp16_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Toggle Attention");
00358        _tmp17_ = g_object_ref_sink (_tmp16_);
00359        _g_object_unref0 (mi);
00360        mi = _tmp17_;
00361        _tmp18_ = mi;
00362        gtk_menu_shell_append ((GtkMenuShell*) menu, (GtkWidget*) _tmp18_);
00363        _tmp19_ = mi;
00364        g_signal_connect (_tmp19_, "activate", (GCallback) ___lambda5__gtk_menu_item_activate, self);
00365        _tmp20_ = self->priv->ci;
00366        _tmp21_ = mi;
00367        app_indicator_set_secondary_activate_target (_tmp20_, (GtkWidget*) _tmp21_);
00368        gtk_widget_show_all ((GtkWidget*) menu);
00369        _tmp22_ = item;
00370        gtk_menu_item_set_submenu (_tmp22_, (GtkWidget*) menu);
00371        _g_object_unref0 (mi);
00372        _g_object_unref0 (menu);
00373        block1_data_unref (_data1_);
00374        _data1_ = NULL;
00375 }
00376 
00377 
00378 static void simple_client_label_toggle (SimpleClient* self, GtkMenuItem* item) {
00379        gboolean _tmp0_;
00380        gboolean _tmp1_;
00381        g_return_if_fail (self != NULL);
00382        g_return_if_fail (item != NULL);
00383        _tmp0_ = self->priv->can_haz_label;
00384        self->priv->can_haz_label = !_tmp0_;
00385        _tmp1_ = self->priv->can_haz_label;
00386        if (_tmp1_) {
00387               GtkMenuItem* _tmp2_;
00388               _tmp2_ = item;
00389               gtk_menu_item_set_label (_tmp2_, "Hide label");
00390        } else {
00391               GtkMenuItem* _tmp3_;
00392               _tmp3_ = item;
00393               gtk_menu_item_set_label (_tmp3_, "Show label");
00394        }
00395 }
00396 
00397 
00398 static Block2Data* block2_data_ref (Block2Data* _data2_) {
00399        g_atomic_int_inc (&_data2_->_ref_count_);
00400        return _data2_;
00401 }
00402 
00403 
00404 static void block2_data_unref (void * _userdata_) {
00405        Block2Data* _data2_;
00406        _data2_ = (Block2Data*) _userdata_;
00407        if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
00408               SimpleClient * self;
00409               self = _data2_->self;
00410               _g_object_unref0 (_data2_->icon);
00411               _g_object_unref0 (_data2_->show);
00412               _g_object_unref0 (_data2_->att);
00413               _g_object_unref0 (_data2_->imgitem);
00414               _g_object_unref0 (_data2_->submenu);
00415               _simple_client_unref0 (self);
00416               g_slice_free (Block2Data, _data2_);
00417        }
00418 }
00419 
00420 
00421 static void __lambda6_ (SimpleClient* self, gint delta, GdkScrollDirection direction) {
00422        gint _tmp0_;
00423        gchar* _tmp1_ = NULL;
00424        gchar* _tmp2_;
00425        GdkScrollDirection _tmp3_;
00426        GEnumValue* _tmp4_;
00427        gchar* _tmp5_ = NULL;
00428        gchar* _tmp6_;
00429        _tmp0_ = delta;
00430        _tmp1_ = g_strdup_printf ("%i", _tmp0_);
00431        _tmp2_ = _tmp1_;
00432        _tmp3_ = direction;
00433        _tmp4_ = g_enum_get_value (g_type_class_ref (GDK_TYPE_SCROLL_DIRECTION), _tmp3_);
00434        _tmp5_ = g_strconcat ("Got scroll event! delta: ", _tmp2_, ", direction: ", (_tmp4_ != NULL) ? _tmp4_->value_name : NULL, "\n", NULL);
00435        _tmp6_ = _tmp5_;
00436        g_print ("%s", _tmp6_);
00437        _g_free0 (_tmp6_);
00438        _g_free0 (_tmp2_);
00439 }
00440 
00441 
00442 static void ___lambda6__app_indicator_scroll_event (AppIndicator* _sender, gint delta, GdkScrollDirection direction, gpointer self) {
00443        __lambda6_ (self, delta, direction);
00444 }
00445 
00446 
00447 static gboolean __lambda7_ (SimpleClient* self) {
00448        gboolean result = FALSE;
00449        gint _tmp0_;
00450        gboolean _tmp1_;
00451        _tmp0_ = self->priv->percentage;
00452        self->priv->percentage = (_tmp0_ + 1) % 100;
00453        _tmp1_ = self->priv->can_haz_label;
00454        if (_tmp1_) {
00455               AppIndicator* _tmp2_;
00456               gint _tmp3_;
00457               gchar* _tmp4_ = NULL;
00458               gchar* _tmp5_;
00459               gchar* _tmp6_ = NULL;
00460               gchar* _tmp7_;
00461               _tmp2_ = self->priv->ci;
00462               _tmp3_ = self->priv->percentage;
00463               _tmp4_ = g_strdup_printf ("%i", _tmp3_ + 1);
00464               _tmp5_ = _tmp4_;
00465               _tmp6_ = g_strconcat (_tmp5_, "%", NULL);
00466               _tmp7_ = _tmp6_;
00467               app_indicator_set_label (_tmp2_, _tmp7_, "");
00468               _g_free0 (_tmp7_);
00469               _g_free0 (_tmp5_);
00470        } else {
00471               AppIndicator* _tmp8_;
00472               _tmp8_ = self->priv->ci;
00473               app_indicator_set_label (_tmp8_, "", "");
00474        }
00475        result = TRUE;
00476        return result;
00477 }
00478 
00479 
00480 static gboolean ___lambda7__gsource_func (gpointer self) {
00481        gboolean result;
00482        result = __lambda7_ (self);
00483        return result;
00484 }
00485 
00486 
00487 static void __lambda8_ (SimpleClient* self) {
00488        g_print ("1\n");
00489 }
00490 
00491 
00492 static void ___lambda8__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00493        __lambda8_ (self);
00494 }
00495 
00496 
00497 static void _g_object_unref0_ (gpointer var) {
00498        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
00499 }
00500 
00501 
00502 static void _g_slist_free__g_object_unref0_ (GSList* self) {
00503        g_slist_foreach (self, (GFunc) _g_object_unref0_, NULL);
00504        g_slist_free (self);
00505 }
00506 
00507 
00508 static void __lambda9_ (SimpleClient* self) {
00509        g_print ("2\n");
00510 }
00511 
00512 
00513 static void ___lambda9__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00514        __lambda9_ (self);
00515 }
00516 
00517 
00518 static void __lambda10_ (Block2Data* _data2_) {
00519        SimpleClient * self;
00520        self = _data2_->self;
00521        simple_client_toggle_sensitivity (self, (GtkWidget*) _data2_->submenu);
00522 }
00523 
00524 
00525 static void ___lambda10__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00526        __lambda10_ (self);
00527 }
00528 
00529 
00530 static void __lambda11_ (Block2Data* _data2_) {
00531        SimpleClient * self;
00532        GtkWidget* _tmp0_ = NULL;
00533        GtkImage* _tmp1_;
00534        GtkImage* img;
00535        self = _data2_->self;
00536        _tmp0_ = gtk_image_menu_item_get_image (_data2_->imgitem);
00537        _tmp1_ = _g_object_ref0 (GTK_IMAGE (_tmp0_));
00538        img = _tmp1_;
00539        gtk_image_set_from_stock (img, GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
00540        _g_object_unref0 (img);
00541 }
00542 
00543 
00544 static void ___lambda11__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00545        __lambda11_ (self);
00546 }
00547 
00548 
00549 static void __lambda12_ (Block2Data* _data2_) {
00550        SimpleClient * self;
00551        gboolean _tmp0_;
00552        self = _data2_->self;
00553        _tmp0_ = self->priv->active;
00554        if (_tmp0_) {
00555               AppIndicator* _tmp1_;
00556               _tmp1_ = self->priv->ci;
00557               app_indicator_set_status (_tmp1_, APP_INDICATOR_STATUS_ATTENTION);
00558               gtk_menu_item_set_label (_data2_->att, "I'm okay now");
00559               self->priv->active = FALSE;
00560        } else {
00561               AppIndicator* _tmp2_;
00562               _tmp2_ = self->priv->ci;
00563               app_indicator_set_status (_tmp2_, APP_INDICATOR_STATUS_ACTIVE);
00564               gtk_menu_item_set_label (_data2_->att, "Get Attention");
00565               self->priv->active = FALSE;
00566        }
00567 }
00568 
00569 
00570 static void ___lambda12__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00571        __lambda12_ (self);
00572 }
00573 
00574 
00575 static void __lambda13_ (Block2Data* _data2_) {
00576        SimpleClient * self;
00577        self = _data2_->self;
00578        simple_client_label_toggle (self, _data2_->show);
00579 }
00580 
00581 
00582 static void ___lambda13__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00583        __lambda13_ (self);
00584 }
00585 
00586 
00587 static void __lambda14_ (Block2Data* _data2_) {
00588        SimpleClient * self;
00589        gboolean _tmp0_ = FALSE;
00590        self = _data2_->self;
00591        _tmp0_ = gtk_check_menu_item_get_active (_data2_->icon);
00592        if (_tmp0_) {
00593               AppIndicator* _tmp1_;
00594               _tmp1_ = self->priv->ci;
00595               app_indicator_set_icon (_tmp1_, "simple-client-test-icon.png");
00596        } else {
00597               AppIndicator* _tmp2_;
00598               _tmp2_ = self->priv->ci;
00599               app_indicator_set_icon (_tmp2_, "indicator-messages");
00600        }
00601 }
00602 
00603 
00604 static void ___lambda14__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
00605        __lambda14_ (self);
00606 }
00607 
00608 
00609 void simple_client_run (SimpleClient* self) {
00610        Block2Data* _data2_;
00611        AppIndicator* _tmp0_;
00612        GtkMenu* _tmp1_;
00613        GtkMenu* _tmp2_;
00614        GtkCheckMenuItem* _tmp3_;
00615        GtkCheckMenuItem* _tmp4_;
00616        GtkCheckMenuItem* chk;
00617        GtkMenu* _tmp5_;
00618        GSList* _tmp6_;
00619        GtkRadioMenuItem* _tmp7_;
00620        GtkRadioMenuItem* _tmp8_;
00621        GtkRadioMenuItem* _tmp9_;
00622        GtkRadioMenuItem* radio;
00623        GtkMenu* _tmp10_;
00624        GtkMenuItem* _tmp11_;
00625        GtkMenuItem* _tmp12_;
00626        GtkMenu* _tmp13_;
00627        GtkMenuItem* _tmp14_;
00628        GtkMenuItem* _tmp15_;
00629        GtkMenuItem* toggle_item;
00630        GtkMenu* _tmp16_;
00631        GtkImageMenuItem* _tmp17_;
00632        GtkImageMenuItem* _tmp18_;
00633        GtkMenu* _tmp19_;
00634        GtkMenuItem* _tmp20_;
00635        GtkMenuItem* _tmp21_;
00636        GtkMenu* _tmp22_;
00637        GtkMenuItem* _tmp23_;
00638        GtkMenuItem* _tmp24_;
00639        GtkMenu* _tmp25_;
00640        GtkCheckMenuItem* _tmp26_;
00641        GtkCheckMenuItem* _tmp27_;
00642        GtkMenu* _tmp28_;
00643        AppIndicator* _tmp29_;
00644        GtkMenu* _tmp30_;
00645        g_return_if_fail (self != NULL);
00646        _data2_ = g_slice_new0 (Block2Data);
00647        _data2_->_ref_count_ = 1;
00648        _data2_->self = simple_client_ref (self);
00649        _tmp0_ = self->priv->ci;
00650        g_signal_connect (_tmp0_, "scroll-event", (GCallback) ___lambda6__app_indicator_scroll_event, self);
00651        g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 1, ___lambda7__gsource_func, simple_client_ref (self), simple_client_unref);
00652        _tmp1_ = (GtkMenu*) gtk_menu_new ();
00653        _tmp2_ = g_object_ref_sink (_tmp1_);
00654        _g_object_unref0 (self->priv->menu);
00655        self->priv->menu = _tmp2_;
00656        _tmp3_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_label ("1");
00657        _tmp4_ = g_object_ref_sink (_tmp3_);
00658        chk = _tmp4_;
00659        g_signal_connect ((GtkMenuItem*) chk, "activate", (GCallback) ___lambda8__gtk_menu_item_activate, self);
00660        _tmp5_ = self->priv->menu;
00661        gtk_menu_shell_append ((GtkMenuShell*) _tmp5_, (GtkWidget*) ((GtkMenuItem*) chk));
00662        gtk_widget_show ((GtkWidget*) chk);
00663        _tmp6_ = NULL;
00664        _tmp7_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_label (_tmp6_, "2");
00665        _tmp8_ = g_object_ref_sink (_tmp7_);
00666        _tmp9_ = _tmp8_;
00667        __g_slist_free__g_object_unref0_0 (_tmp6_);
00668        radio = _tmp9_;
00669        g_signal_connect ((GtkMenuItem*) radio, "activate", (GCallback) ___lambda9__gtk_menu_item_activate, self);
00670        _tmp10_ = self->priv->menu;
00671        gtk_menu_shell_append ((GtkMenuShell*) _tmp10_, (GtkWidget*) ((GtkMenuItem*) radio));
00672        gtk_widget_show ((GtkWidget*) radio);
00673        _tmp11_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("3");
00674        _tmp12_ = g_object_ref_sink (_tmp11_);
00675        _data2_->submenu = _tmp12_;
00676        _tmp13_ = self->priv->menu;
00677        gtk_menu_shell_append ((GtkMenuShell*) _tmp13_, (GtkWidget*) _data2_->submenu);
00678        simple_client_append_submenu (self, _data2_->submenu);
00679        gtk_widget_show ((GtkWidget*) _data2_->submenu);
00680        _tmp14_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Toggle 3");
00681        _tmp15_ = g_object_ref_sink (_tmp14_);
00682        toggle_item = _tmp15_;
00683        g_signal_connect_data (toggle_item, "activate", (GCallback) ___lambda10__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
00684        _tmp16_ = self->priv->menu;
00685        gtk_menu_shell_append ((GtkMenuShell*) _tmp16_, (GtkWidget*) toggle_item);
00686        gtk_widget_show ((GtkWidget*) toggle_item);
00687        _tmp17_ = (GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL);
00688        _tmp18_ = g_object_ref_sink (_tmp17_);
00689        _data2_->imgitem = _tmp18_;
00690        g_signal_connect_data ((GtkMenuItem*) _data2_->imgitem, "activate", (GCallback) ___lambda11__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
00691        _tmp19_ = self->priv->menu;
00692        gtk_menu_shell_append ((GtkMenuShell*) _tmp19_, (GtkWidget*) ((GtkMenuItem*) _data2_->imgitem));
00693        gtk_widget_show ((GtkWidget*) _data2_->imgitem);
00694        _tmp20_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Get Attention");
00695        _tmp21_ = g_object_ref_sink (_tmp20_);
00696        _data2_->att = _tmp21_;
00697        g_signal_connect_data (_data2_->att, "activate", (GCallback) ___lambda12__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
00698        _tmp22_ = self->priv->menu;
00699        gtk_menu_shell_append ((GtkMenuShell*) _tmp22_, (GtkWidget*) _data2_->att);
00700        gtk_widget_show ((GtkWidget*) _data2_->att);
00701        _tmp23_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Show Label");
00702        _tmp24_ = g_object_ref_sink (_tmp23_);
00703        _data2_->show = _tmp24_;
00704        simple_client_label_toggle (self, _data2_->show);
00705        g_signal_connect_data (_data2_->show, "activate", (GCallback) ___lambda13__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
00706        _tmp25_ = self->priv->menu;
00707        gtk_menu_shell_append ((GtkMenuShell*) _tmp25_, (GtkWidget*) _data2_->show);
00708        gtk_widget_show ((GtkWidget*) _data2_->show);
00709        _tmp26_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_label ("Set Local Icon");
00710        _tmp27_ = g_object_ref_sink (_tmp26_);
00711        _data2_->icon = _tmp27_;
00712        g_signal_connect_data ((GtkMenuItem*) _data2_->icon, "activate", (GCallback) ___lambda14__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
00713        _tmp28_ = self->priv->menu;
00714        gtk_menu_shell_append ((GtkMenuShell*) _tmp28_, (GtkWidget*) ((GtkMenuItem*) _data2_->icon));
00715        gtk_widget_show ((GtkWidget*) _data2_->icon);
00716        _tmp29_ = self->priv->ci;
00717        _tmp30_ = self->priv->menu;
00718        app_indicator_set_menu (_tmp29_, _tmp30_);
00719        gtk_main ();
00720        _g_object_unref0 (toggle_item);
00721        _g_object_unref0 (radio);
00722        _g_object_unref0 (chk);
00723        block2_data_unref (_data2_);
00724        _data2_ = NULL;
00725 }
00726 
00727 
00728 static void value_simple_client_init (GValue* value) {
00729        value->data[0].v_pointer = NULL;
00730 }
00731 
00732 
00733 static void value_simple_client_free_value (GValue* value) {
00734        if (value->data[0].v_pointer) {
00735               simple_client_unref (value->data[0].v_pointer);
00736        }
00737 }
00738 
00739 
00740 static void value_simple_client_copy_value (const GValue* src_value, GValue* dest_value) {
00741        if (src_value->data[0].v_pointer) {
00742               dest_value->data[0].v_pointer = simple_client_ref (src_value->data[0].v_pointer);
00743        } else {
00744               dest_value->data[0].v_pointer = NULL;
00745        }
00746 }
00747 
00748 
00749 static gpointer value_simple_client_peek_pointer (const GValue* value) {
00750        return value->data[0].v_pointer;
00751 }
00752 
00753 
00754 static gchar* value_simple_client_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
00755        if (collect_values[0].v_pointer) {
00756               SimpleClient* object;
00757               object = collect_values[0].v_pointer;
00758               if (object->parent_instance.g_class == NULL) {
00759                      return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
00760               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
00761                      return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
00762               }
00763               value->data[0].v_pointer = simple_client_ref (object);
00764        } else {
00765               value->data[0].v_pointer = NULL;
00766        }
00767        return NULL;
00768 }
00769 
00770 
00771 static gchar* value_simple_client_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
00772        SimpleClient** object_p;
00773        object_p = collect_values[0].v_pointer;
00774        if (!object_p) {
00775               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
00776        }
00777        if (!value->data[0].v_pointer) {
00778               *object_p = NULL;
00779        } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
00780               *object_p = value->data[0].v_pointer;
00781        } else {
00782               *object_p = simple_client_ref (value->data[0].v_pointer);
00783        }
00784        return NULL;
00785 }
00786 
00787 
00788 GParamSpec* param_spec_simple_client (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
00789        ParamSpecSimpleClient* spec;
00790        g_return_val_if_fail (g_type_is_a (object_type, TYPE_SIMPLE_CLIENT), NULL);
00791        spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
00792        G_PARAM_SPEC (spec)->value_type = object_type;
00793        return G_PARAM_SPEC (spec);
00794 }
00795 
00796 
00797 gpointer value_get_simple_client (const GValue* value) {
00798        g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SIMPLE_CLIENT), NULL);
00799        return value->data[0].v_pointer;
00800 }
00801 
00802 
00803 void value_set_simple_client (GValue* value, gpointer v_object) {
00804        SimpleClient* old;
00805        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SIMPLE_CLIENT));
00806        old = value->data[0].v_pointer;
00807        if (v_object) {
00808               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SIMPLE_CLIENT));
00809               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
00810               value->data[0].v_pointer = v_object;
00811               simple_client_ref (value->data[0].v_pointer);
00812        } else {
00813               value->data[0].v_pointer = NULL;
00814        }
00815        if (old) {
00816               simple_client_unref (old);
00817        }
00818 }
00819 
00820 
00821 void value_take_simple_client (GValue* value, gpointer v_object) {
00822        SimpleClient* old;
00823        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_SIMPLE_CLIENT));
00824        old = value->data[0].v_pointer;
00825        if (v_object) {
00826               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_SIMPLE_CLIENT));
00827               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
00828               value->data[0].v_pointer = v_object;
00829        } else {
00830               value->data[0].v_pointer = NULL;
00831        }
00832        if (old) {
00833               simple_client_unref (old);
00834        }
00835 }
00836 
00837 
00838 static void simple_client_class_init (SimpleClientClass * klass) {
00839        simple_client_parent_class = g_type_class_peek_parent (klass);
00840        SIMPLE_CLIENT_CLASS (klass)->finalize = simple_client_finalize;
00841        g_type_class_add_private (klass, sizeof (SimpleClientPrivate));
00842 }
00843 
00844 
00845 static void simple_client_instance_init (SimpleClient * self) {
00846        self->priv = SIMPLE_CLIENT_GET_PRIVATE (self);
00847        self->ref_count = 1;
00848 }
00849 
00850 
00851 static void simple_client_finalize (SimpleClient* obj) {
00852        SimpleClient * self;
00853        self = SIMPLE_CLIENT (obj);
00854        _g_object_unref0 (self->priv->menu);
00855        _g_object_unref0 (self->priv->ci);
00856 }
00857 
00858 
00859 GType simple_client_get_type (void) {
00860        static volatile gsize simple_client_type_id__volatile = 0;
00861        if (g_once_init_enter (&simple_client_type_id__volatile)) {
00862               static const GTypeValueTable g_define_type_value_table = { value_simple_client_init, value_simple_client_free_value, value_simple_client_copy_value, value_simple_client_peek_pointer, "p", value_simple_client_collect_value, "p", value_simple_client_lcopy_value };
00863               static const GTypeInfo g_define_type_info = { sizeof (SimpleClientClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) simple_client_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SimpleClient), 0, (GInstanceInitFunc) simple_client_instance_init, &g_define_type_value_table };
00864               static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
00865               GType simple_client_type_id;
00866               simple_client_type_id = g_type_register_fundamental (g_type_fundamental_next (), "SimpleClient", &g_define_type_info, &g_define_type_fundamental_info, 0);
00867               g_once_init_leave (&simple_client_type_id__volatile, simple_client_type_id);
00868        }
00869        return simple_client_type_id__volatile;
00870 }
00871 
00872 
00873 gpointer simple_client_ref (gpointer instance) {
00874        SimpleClient* self;
00875        self = instance;
00876        g_atomic_int_inc (&self->ref_count);
00877        return instance;
00878 }
00879 
00880 
00881 void simple_client_unref (gpointer instance) {
00882        SimpleClient* self;
00883        self = instance;
00884        if (g_atomic_int_dec_and_test (&self->ref_count)) {
00885               SIMPLE_CLIENT_GET_CLASS (self)->finalize (self);
00886               g_type_free_instance ((GTypeInstance *) self);
00887        }
00888 }
00889 
00890 
00891