diff options
author | Ted Gould <ted@gould.cx> | 2011-08-11 12:02:16 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-08-11 12:02:16 -0500 |
commit | 8c352cdc40eced52767ddca7036fa7b76bf42a6b (patch) | |
tree | 4a628c94c7913385dfcf098c85b63188eedc6200 /example/simple-client-vala.c | |
parent | fc03ef7c10bf76edc87af4cc54194fe1bf6e28c2 (diff) | |
parent | 1bfe91a779b5d71cf3e6bf066182af38995fa4bf (diff) | |
download | libayatana-appindicator-8c352cdc40eced52767ddca7036fa7b76bf42a6b.tar.gz libayatana-appindicator-8c352cdc40eced52767ddca7036fa7b76bf42a6b.tar.bz2 libayatana-appindicator-8c352cdc40eced52767ddca7036fa7b76bf42a6b.zip |
Import upstream version 0.3.91
Diffstat (limited to 'example/simple-client-vala.c')
-rw-r--r-- | example/simple-client-vala.c | 199 |
1 files changed, 108 insertions, 91 deletions
diff --git a/example/simple-client-vala.c b/example/simple-client-vala.c index 44dca9e..fa77cb5 100644 --- a/example/simple-client-vala.c +++ b/example/simple-client-vala.c @@ -1,4 +1,4 @@ -/* simple-client-vala.c generated by valac 0.11.6, the Vala compiler +/* simple-client-vala.c generated by valac 0.12.1, the Vala compiler * generated from simple-client-vala.vala, do not modify */ /* @@ -117,20 +117,20 @@ static void _lambda1_ (Block1Data* _data1_); static void __lambda1__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self); static void _lambda2_ (SimpleClient* self); static void __lambda2__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self); +static void _lambda3_ (SimpleClient* self); +static void __lambda3__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self); static void simple_client_label_toggle (SimpleClient* self, GtkMenuItem* item); static Block2Data* block2_data_ref (Block2Data* _data2_); static void block2_data_unref (Block2Data* _data2_); -static void _lambda3_ (gint delta, guint direction, SimpleClient* self); -static void __lambda3__app_indicator_scroll_event (AppIndicator* _sender, gint indicator, guint delta, gpointer self); -static gboolean _lambda4_ (SimpleClient* self); -static gboolean __lambda4__gsource_func (gpointer self); -static void _lambda5_ (SimpleClient* self); -static void __lambda5__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self); -static void _g_object_unref0_ (gpointer var); -static void _g_slist_free__g_object_unref0_ (GSList* self); +static void _lambda4_ (gint delta, guint direction, SimpleClient* self); +static void __lambda4__app_indicator_scroll_event (AppIndicator* _sender, gint indicator, guint delta, gpointer self); +static gboolean _lambda5_ (SimpleClient* self); +static gboolean __lambda5__gsource_func (gpointer self); static void _lambda6_ (SimpleClient* self); static void __lambda6__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self); -static void _lambda7_ (Block2Data* _data2_); +static void _g_object_unref0_ (gpointer var); +static void _g_slist_free__g_object_unref0_ (GSList* self); +static void _lambda7_ (SimpleClient* self); static void __lambda7__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self); static void _lambda8_ (Block2Data* _data2_); static void __lambda8__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self); @@ -140,6 +140,8 @@ static void _lambda10_ (Block2Data* _data2_); static void __lambda10__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self); static void _lambda11_ (Block2Data* _data2_); static void __lambda11__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self); +static void _lambda12_ (Block2Data* _data2_); +static void __lambda12__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self); static void simple_client_finalize (SimpleClient* obj); @@ -165,13 +167,11 @@ int main (int argc, char ** argv) { SimpleClient* simple_client_construct (GType object_type, gchar** args, int args_length1) { SimpleClient* self = NULL; AppIndicator* _tmp0_ = NULL; - AppIndicator* _tmp1_; self = (SimpleClient*) g_type_create_instance (object_type); gtk_init (&args_length1, &args); _tmp0_ = app_indicator_new ("example-simple-client", "indicator-messages", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - _tmp1_ = _tmp0_; _g_object_unref0 (self->priv->ci); - self->priv->ci = _tmp1_; + self->priv->ci = _tmp0_; app_indicator_set_status (self->priv->ci, APP_INDICATOR_STATUS_ACTIVE); app_indicator_set_attention_icon (self->priv->ci, "indicator-messages-new"); app_indicator_set_label (self->priv->ci, "1%", "100%"); @@ -247,6 +247,22 @@ static void __lambda2__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer se } +static void _lambda3_ (SimpleClient* self) { + AppIndicatorStatus _tmp0_; + _tmp0_ = app_indicator_get_status (self->priv->ci); + if (_tmp0_ == APP_INDICATOR_STATUS_ATTENTION) { + app_indicator_set_status (self->priv->ci, APP_INDICATOR_STATUS_ACTIVE); + } else { + app_indicator_set_status (self->priv->ci, APP_INDICATOR_STATUS_ATTENTION); + } +} + + +static void __lambda3__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { + _lambda3_ (self); +} + + static void simple_client_append_submenu (SimpleClient* self, GtkMenuItem* item) { Block1Data* _data1_; GtkMenu* _tmp0_ = NULL; @@ -254,11 +270,9 @@ static void simple_client_append_submenu (SimpleClient* self, GtkMenuItem* item) GtkMenuItem* mi = NULL; GtkMenuItem* _tmp1_ = NULL; GtkMenuItem* _tmp2_; - GtkMenuItem* _tmp3_; + GtkMenuItem* _tmp3_ = NULL; GtkMenuItem* _tmp4_ = NULL; - GtkMenuItem* _tmp5_; - GtkMenuItem* _tmp6_ = NULL; - GtkMenuItem* _tmp7_; + GtkMenuItem* _tmp5_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (item != NULL); _data1_ = g_slice_new0 (Block1Data); @@ -267,25 +281,28 @@ static void simple_client_append_submenu (SimpleClient* self, GtkMenuItem* item) _tmp0_ = (GtkMenu*) gtk_menu_new (); menu = g_object_ref_sink (_tmp0_); _tmp1_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Sub 1"); - _tmp2_ = g_object_ref_sink (_tmp1_); _g_object_unref0 (mi); - mi = _tmp2_; + mi = g_object_ref_sink (_tmp1_); gtk_menu_shell_append ((GtkMenuShell*) menu, (GtkWidget*) mi); g_signal_connect (mi, "activate", (GCallback) __lambda0__gtk_menu_item_activate, self); - _tmp3_ = _g_object_ref0 (mi); - _data1_->prev_mi = _tmp3_; - _tmp4_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Sub 2"); - _tmp5_ = g_object_ref_sink (_tmp4_); + _tmp2_ = _g_object_ref0 (mi); + _data1_->prev_mi = _tmp2_; + _tmp3_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Sub 2"); _g_object_unref0 (mi); - mi = _tmp5_; + mi = g_object_ref_sink (_tmp3_); gtk_menu_shell_append ((GtkMenuShell*) menu, (GtkWidget*) mi); g_signal_connect_data (mi, "activate", (GCallback) __lambda1__gtk_menu_item_activate, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); - _tmp6_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Sub 3"); - _tmp7_ = g_object_ref_sink (_tmp6_); + _tmp4_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Sub 3"); _g_object_unref0 (mi); - mi = _tmp7_; + mi = g_object_ref_sink (_tmp4_); gtk_menu_shell_append ((GtkMenuShell*) menu, (GtkWidget*) mi); g_signal_connect (mi, "activate", (GCallback) __lambda2__gtk_menu_item_activate, self); + _tmp5_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Toggle Attention"); + _g_object_unref0 (mi); + mi = g_object_ref_sink (_tmp5_); + gtk_menu_shell_append ((GtkMenuShell*) menu, (GtkWidget*) mi); + g_signal_connect (mi, "activate", (GCallback) __lambda3__gtk_menu_item_activate, self); + app_indicator_set_secondary_activate_target (self->priv->ci, (GtkWidget*) mi); gtk_widget_show_all ((GtkWidget*) menu); gtk_menu_item_set_submenu (item, (GtkWidget*) menu); _g_object_unref0 (mi); @@ -326,7 +343,7 @@ static void block2_data_unref (Block2Data* _data2_) { } -static void _lambda3_ (gint delta, guint direction, SimpleClient* self) { +static void _lambda4_ (gint delta, guint direction, SimpleClient* self) { gchar* _tmp0_ = NULL; gchar* _tmp1_; gchar* _tmp2_ = NULL; @@ -346,12 +363,12 @@ static void _lambda3_ (gint delta, guint direction, SimpleClient* self) { } -static void __lambda3__app_indicator_scroll_event (AppIndicator* _sender, gint indicator, guint delta, gpointer self) { - _lambda3_ (indicator, delta, self); +static void __lambda4__app_indicator_scroll_event (AppIndicator* _sender, gint indicator, guint delta, gpointer self) { + _lambda4_ (indicator, delta, self); } -static gboolean _lambda4_ (SimpleClient* self) { +static gboolean _lambda5_ (SimpleClient* self) { gboolean result = FALSE; self->priv->percentage = (self->priv->percentage + 1) % 100; if (self->priv->can_haz_label) { @@ -374,20 +391,20 @@ static gboolean _lambda4_ (SimpleClient* self) { } -static gboolean __lambda4__gsource_func (gpointer self) { +static gboolean __lambda5__gsource_func (gpointer self) { gboolean result; - result = _lambda4_ (self); + result = _lambda5_ (self); return result; } -static void _lambda5_ (SimpleClient* self) { +static void _lambda6_ (SimpleClient* self) { g_print ("1\n"); } -static void __lambda5__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { - _lambda5_ (self); +static void __lambda6__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { + _lambda6_ (self); } @@ -402,29 +419,29 @@ static void _g_slist_free__g_object_unref0_ (GSList* self) { } -static void _lambda6_ (SimpleClient* self) { +static void _lambda7_ (SimpleClient* self) { g_print ("2\n"); } -static void __lambda6__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { - _lambda6_ (self); +static void __lambda7__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { + _lambda7_ (self); } -static void _lambda7_ (Block2Data* _data2_) { +static void _lambda8_ (Block2Data* _data2_) { SimpleClient * self; self = _data2_->self; simple_client_toggle_sensitivity (self, (GtkWidget*) _data2_->submenu); } -static void __lambda7__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { - _lambda7_ (self); +static void __lambda8__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { + _lambda8_ (self); } -static void _lambda8_ (Block2Data* _data2_) { +static void _lambda9_ (Block2Data* _data2_) { SimpleClient * self; GtkWidget* _tmp0_ = NULL; GtkImage* _tmp1_; @@ -438,12 +455,12 @@ static void _lambda8_ (Block2Data* _data2_) { } -static void __lambda8__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { - _lambda8_ (self); +static void __lambda9__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { + _lambda9_ (self); } -static void _lambda9_ (Block2Data* _data2_) { +static void _lambda10_ (Block2Data* _data2_) { SimpleClient * self; self = _data2_->self; if (self->priv->active) { @@ -458,24 +475,24 @@ static void _lambda9_ (Block2Data* _data2_) { } -static void __lambda9__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { - _lambda9_ (self); +static void __lambda10__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { + _lambda10_ (self); } -static void _lambda10_ (Block2Data* _data2_) { +static void _lambda11_ (Block2Data* _data2_) { SimpleClient * self; self = _data2_->self; simple_client_label_toggle (self, _data2_->show); } -static void __lambda10__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { - _lambda10_ (self); +static void __lambda11__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { + _lambda11_ (self); } -static void _lambda11_ (Block2Data* _data2_) { +static void _lambda12_ (Block2Data* _data2_) { SimpleClient * self; gboolean _tmp0_; self = _data2_->self; @@ -488,78 +505,78 @@ static void _lambda11_ (Block2Data* _data2_) { } -static void __lambda11__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { - _lambda11_ (self); +static void __lambda12__gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) { + _lambda12_ (self); } void simple_client_run (SimpleClient* self) { Block2Data* _data2_; GtkMenu* _tmp0_ = NULL; - GtkMenu* _tmp1_; - GtkCheckMenuItem* _tmp2_ = NULL; + GtkCheckMenuItem* _tmp1_ = NULL; GtkCheckMenuItem* chk; - GSList* _tmp3_; - GtkRadioMenuItem* _tmp4_ = NULL; - GtkRadioMenuItem* _tmp5_; + GSList* _tmp2_; + GtkRadioMenuItem* _tmp3_ = NULL; + GtkRadioMenuItem* _tmp4_; GtkRadioMenuItem* radio; + GtkMenuItem* _tmp5_ = NULL; GtkMenuItem* _tmp6_ = NULL; - GtkMenuItem* _tmp7_ = NULL; GtkMenuItem* toggle_item; - GtkImageMenuItem* _tmp8_ = NULL; + GtkImageMenuItem* _tmp7_ = NULL; + GtkMenuItem* _tmp8_ = NULL; GtkMenuItem* _tmp9_ = NULL; - GtkMenuItem* _tmp10_ = NULL; - GtkCheckMenuItem* _tmp11_ = NULL; + GtkCheckMenuItem* _tmp10_ = NULL; g_return_if_fail (self != NULL); _data2_ = g_slice_new0 (Block2Data); _data2_->_ref_count_ = 1; _data2_->self = simple_client_ref (self); - g_signal_connect (self->priv->ci, "scroll-event", (GCallback) __lambda3__app_indicator_scroll_event, self); - g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 1, __lambda4__gsource_func, simple_client_ref (self), simple_client_unref); + g_signal_connect (self->priv->ci, "scroll-event", (GCallback) __lambda4__app_indicator_scroll_event, self); + g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 1, __lambda5__gsource_func, simple_client_ref (self), simple_client_unref); _tmp0_ = (GtkMenu*) gtk_menu_new (); - _tmp1_ = g_object_ref_sink (_tmp0_); _g_object_unref0 (self->priv->menu); - self->priv->menu = _tmp1_; - _tmp2_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_label ("1"); - chk = g_object_ref_sink (_tmp2_); - g_signal_connect ((GtkMenuItem*) chk, "activate", (GCallback) __lambda5__gtk_menu_item_activate, self); + self->priv->menu = g_object_ref_sink (_tmp0_); + _tmp1_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_label ("1"); + chk = g_object_ref_sink (_tmp1_); + g_signal_connect ((GtkMenuItem*) chk, "activate", (GCallback) __lambda6__gtk_menu_item_activate, self); gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) ((GtkMenuItem*) chk)); gtk_widget_show ((GtkWidget*) chk); - _tmp3_ = NULL; - _tmp4_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_label (_tmp3_, "2"); - radio = (_tmp5_ = g_object_ref_sink (_tmp4_), __g_slist_free__g_object_unref0_0 (_tmp3_), _tmp5_); - g_signal_connect ((GtkMenuItem*) radio, "activate", (GCallback) __lambda6__gtk_menu_item_activate, self); + _tmp2_ = NULL; + _tmp3_ = (GtkRadioMenuItem*) gtk_radio_menu_item_new_with_label (_tmp2_, "2"); + _tmp4_ = g_object_ref_sink (_tmp3_); + __g_slist_free__g_object_unref0_0 (_tmp2_); + radio = _tmp4_; + g_signal_connect ((GtkMenuItem*) radio, "activate", (GCallback) __lambda7__gtk_menu_item_activate, self); gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) ((GtkMenuItem*) radio)); gtk_widget_show ((GtkWidget*) radio); - _tmp6_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("3"); - _data2_->submenu = g_object_ref_sink (_tmp6_); + _tmp5_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("3"); + _data2_->submenu = g_object_ref_sink (_tmp5_); gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) _data2_->submenu); simple_client_append_submenu (self, _data2_->submenu); gtk_widget_show ((GtkWidget*) _data2_->submenu); - _tmp7_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Toggle 3"); - toggle_item = g_object_ref_sink (_tmp7_); - g_signal_connect_data (toggle_item, "activate", (GCallback) __lambda7__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); + _tmp6_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Toggle 3"); + toggle_item = g_object_ref_sink (_tmp6_); + g_signal_connect_data (toggle_item, "activate", (GCallback) __lambda8__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) toggle_item); gtk_widget_show ((GtkWidget*) toggle_item); - _tmp8_ = (GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); - _data2_->imgitem = g_object_ref_sink (_tmp8_); - g_signal_connect_data ((GtkMenuItem*) _data2_->imgitem, "activate", (GCallback) __lambda8__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); + _tmp7_ = (GtkImageMenuItem*) gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); + _data2_->imgitem = g_object_ref_sink (_tmp7_); + g_signal_connect_data ((GtkMenuItem*) _data2_->imgitem, "activate", (GCallback) __lambda9__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) ((GtkMenuItem*) _data2_->imgitem)); gtk_widget_show ((GtkWidget*) _data2_->imgitem); - _tmp9_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Get Attention"); - _data2_->att = g_object_ref_sink (_tmp9_); - g_signal_connect_data (_data2_->att, "activate", (GCallback) __lambda9__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); + _tmp8_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Get Attention"); + _data2_->att = g_object_ref_sink (_tmp8_); + g_signal_connect_data (_data2_->att, "activate", (GCallback) __lambda10__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) _data2_->att); gtk_widget_show ((GtkWidget*) _data2_->att); - _tmp10_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Show Label"); - _data2_->show = g_object_ref_sink (_tmp10_); + _tmp9_ = (GtkMenuItem*) gtk_menu_item_new_with_label ("Show Label"); + _data2_->show = g_object_ref_sink (_tmp9_); simple_client_label_toggle (self, _data2_->show); - g_signal_connect_data (_data2_->show, "activate", (GCallback) __lambda10__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); + g_signal_connect_data (_data2_->show, "activate", (GCallback) __lambda11__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) _data2_->show); gtk_widget_show ((GtkWidget*) _data2_->show); - _tmp11_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_label ("Set Local Icon"); - _data2_->icon = g_object_ref_sink (_tmp11_); - g_signal_connect_data ((GtkMenuItem*) _data2_->icon, "activate", (GCallback) __lambda11__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); + _tmp10_ = (GtkCheckMenuItem*) gtk_check_menu_item_new_with_label ("Set Local Icon"); + _data2_->icon = g_object_ref_sink (_tmp10_); + g_signal_connect_data ((GtkMenuItem*) _data2_->icon, "activate", (GCallback) __lambda12__gtk_menu_item_activate, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); gtk_menu_shell_append ((GtkMenuShell*) self->priv->menu, (GtkWidget*) ((GtkMenuItem*) _data2_->icon)); gtk_widget_show ((GtkWidget*) _data2_->icon); app_indicator_set_menu (self->priv->ci, self->priv->menu); |