From 28d217863f9c72d0ca3f1e16fe7f7da058b43346 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 13 Jul 2022 23:32:15 +0200 Subject: Whitespace fix --- example/simple-client-vala.vala | 306 ++++++++++++++++++++-------------------- example/simple-client.c | 14 +- 2 files changed, 160 insertions(+), 160 deletions(-) (limited to 'example') diff --git a/example/simple-client-vala.vala b/example/simple-client-vala.vala index c30bf34..510056a 100644 --- a/example/simple-client-vala.vala +++ b/example/simple-client-vala.vala @@ -7,16 +7,16 @@ Copyright 2011 Canonical Ltd. Authors: Marco Trevisan -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -24,159 +24,159 @@ using Gtk; using AppIndicator; static int main(string[] args) { - var sc = new SimpleClient(args); - sc.run(); - return 0; + var sc = new SimpleClient(args); + sc.run(); + return 0; } class SimpleClient { - Gtk.Menu menu; - Indicator ci; - int percentage; - bool active; - bool can_haz_label; + Gtk.Menu menu; + Indicator ci; + int percentage; + bool active; + bool can_haz_label; - public SimpleClient(string[] args) { - Gtk.init(ref args); + public SimpleClient(string[] args) { + Gtk.init(ref args); - ci = new Indicator("example-simple-client", + ci = new Indicator("example-simple-client", "indicator-messages", IndicatorCategory.APPLICATION_STATUS); - ci.set_status(IndicatorStatus.ACTIVE); - ci.set_attention_icon("indicator-messages-new"); - ci.set_label("1%", "100%"); - ci.set_title("Test Indicator (vala)"); - - active = true; - can_haz_label = true; - } - - private void toggle_sensitivity(Widget widget) { - widget.set_sensitive(!widget.is_sensitive()); - } - - private void append_submenu(Gtk.MenuItem item) { - var menu = new Gtk.Menu(); - Gtk.MenuItem mi; - - mi = new Gtk.MenuItem.with_label("Sub 1"); - menu.append(mi); - mi.activate.connect(() => { print("Sub1\n"); }); - - Gtk.MenuItem prev_mi = mi; - mi = new Gtk.MenuItem.with_label("Sub 2"); - menu.append(mi); - mi.activate.connect(() => { toggle_sensitivity(prev_mi); }); - - mi = new Gtk.MenuItem.with_label("Sub 3"); - menu.append(mi); - mi.activate.connect(() => { print("Sub3\n"); }); - - mi = new Gtk.MenuItem.with_label("Toggle Attention"); - menu.append(mi); - mi.activate.connect(() => { - if (ci.get_status() == IndicatorStatus.ATTENTION) - ci.set_status(IndicatorStatus.ACTIVE); - else - ci.set_status(IndicatorStatus.ATTENTION); - }); - - ci.set_secondary_activate_target(mi); - - menu.show_all(); - item.set_submenu(menu); - } - - private void label_toggle(Gtk.MenuItem item) { - can_haz_label = !can_haz_label; - - if (can_haz_label) { - item.set_label("Hide label"); - } else { - item.set_label("Show label"); - } - } - - public void run() { - - ci.scroll_event.connect((delta, direction) => { - print(@"Got scroll event! delta: $delta, direction: $direction\n"); - }); - - GLib.Timeout.add_seconds(1, () => { - percentage = (percentage + 1) % 100; - if (can_haz_label) { - ci.set_label(@"$(percentage+1)%", ""); - } else { - ci.set_label("", ""); - } - return true; - }); - - menu = new Gtk.Menu(); - var chk = new CheckMenuItem.with_label("1"); - chk.activate.connect(() => { print("1\n"); }); - menu.append(chk); - chk.show(); - - var radio = new Gtk.RadioMenuItem.with_label(new SList(), "2"); - radio.activate.connect(() => { print("2\n"); }); - menu.append(radio); - radio.show(); - - var submenu = new Gtk.MenuItem.with_label("3"); - menu.append(submenu); - append_submenu(submenu); - submenu.show(); - - var toggle_item = new Gtk.MenuItem.with_label("Toggle 3"); - toggle_item.activate.connect(() => { toggle_sensitivity(submenu); }); - menu.append(toggle_item); - toggle_item.show(); - - var imgitem = new Gtk.ImageMenuItem.from_stock(Stock.NEW, null); - imgitem.activate.connect(() => { - Image img = (Image) imgitem.get_image(); - img.set_from_stock(Stock.OPEN, IconSize.MENU); - }); - menu.append(imgitem); - imgitem.show(); - - var att = new Gtk.MenuItem.with_label("Get Attention"); - att.activate.connect(() => { - if (active) { - ci.set_status(IndicatorStatus.ATTENTION); - att.set_label("I'm okay now"); - active = false; - } else { - ci.set_status(IndicatorStatus.ACTIVE); - att.set_label("Get Attention"); - active = false; - } - }); - menu.append(att); - att.show(); - - var show = new Gtk.MenuItem.with_label("Show Label"); - label_toggle(show); - show.activate.connect(() => { label_toggle(show); }); - menu.append(show); - show.show(); - - var icon = new Gtk.CheckMenuItem.with_label("Set Local Icon"); - icon.activate.connect(() => { - if (icon.get_active()) { - ci.set_icon("simple-client-test-icon.png"); - } else { - ci.set_icon("indicator-messages"); - } - }); - menu.append(icon); - icon.show(); - - ci.set_menu(menu); - - Gtk.main(); - } + ci.set_status(IndicatorStatus.ACTIVE); + ci.set_attention_icon("indicator-messages-new"); + ci.set_label("1%", "100%"); + ci.set_title("Test Indicator (vala)"); + + active = true; + can_haz_label = true; + } + + private void toggle_sensitivity(Widget widget) { + widget.set_sensitive(!widget.is_sensitive()); + } + + private void append_submenu(Gtk.MenuItem item) { + var menu = new Gtk.Menu(); + Gtk.MenuItem mi; + + mi = new Gtk.MenuItem.with_label("Sub 1"); + menu.append(mi); + mi.activate.connect(() => { print("Sub1\n"); }); + + Gtk.MenuItem prev_mi = mi; + mi = new Gtk.MenuItem.with_label("Sub 2"); + menu.append(mi); + mi.activate.connect(() => { toggle_sensitivity(prev_mi); }); + + mi = new Gtk.MenuItem.with_label("Sub 3"); + menu.append(mi); + mi.activate.connect(() => { print("Sub3\n"); }); + + mi = new Gtk.MenuItem.with_label("Toggle Attention"); + menu.append(mi); + mi.activate.connect(() => { + if (ci.get_status() == IndicatorStatus.ATTENTION) + ci.set_status(IndicatorStatus.ACTIVE); + else + ci.set_status(IndicatorStatus.ATTENTION); + }); + + ci.set_secondary_activate_target(mi); + + menu.show_all(); + item.set_submenu(menu); + } + + private void label_toggle(Gtk.MenuItem item) { + can_haz_label = !can_haz_label; + + if (can_haz_label) { + item.set_label("Hide label"); + } else { + item.set_label("Show label"); + } + } + + public void run() { + + ci.scroll_event.connect((delta, direction) => { + print(@"Got scroll event! delta: $delta, direction: $direction\n"); + }); + + GLib.Timeout.add_seconds(1, () => { + percentage = (percentage + 1) % 100; + if (can_haz_label) { + ci.set_label(@"$(percentage+1)%", ""); + } else { + ci.set_label("", ""); + } + return true; + }); + + menu = new Gtk.Menu(); + var chk = new CheckMenuItem.with_label("1"); + chk.activate.connect(() => { print("1\n"); }); + menu.append(chk); + chk.show(); + + var radio = new Gtk.RadioMenuItem.with_label(new SList(), "2"); + radio.activate.connect(() => { print("2\n"); }); + menu.append(radio); + radio.show(); + + var submenu = new Gtk.MenuItem.with_label("3"); + menu.append(submenu); + append_submenu(submenu); + submenu.show(); + + var toggle_item = new Gtk.MenuItem.with_label("Toggle 3"); + toggle_item.activate.connect(() => { toggle_sensitivity(submenu); }); + menu.append(toggle_item); + toggle_item.show(); + + var imgitem = new Gtk.ImageMenuItem.from_stock(Stock.NEW, null); + imgitem.activate.connect(() => { + Image img = (Image) imgitem.get_image(); + img.set_from_stock(Stock.OPEN, IconSize.MENU); + }); + menu.append(imgitem); + imgitem.show(); + + var att = new Gtk.MenuItem.with_label("Get Attention"); + att.activate.connect(() => { + if (active) { + ci.set_status(IndicatorStatus.ATTENTION); + att.set_label("I'm okay now"); + active = false; + } else { + ci.set_status(IndicatorStatus.ACTIVE); + att.set_label("Get Attention"); + active = false; + } + }); + menu.append(att); + att.show(); + + var show = new Gtk.MenuItem.with_label("Show Label"); + label_toggle(show); + show.activate.connect(() => { label_toggle(show); }); + menu.append(show); + show.show(); + + var icon = new Gtk.CheckMenuItem.with_label("Set Local Icon"); + icon.activate.connect(() => { + if (icon.get_active()) { + ci.set_icon("simple-client-test-icon.png"); + } else { + ci.set_icon("indicator-messages"); + } + }); + menu.append(icon); + icon.show(); + + ci.set_menu(menu); + + Gtk.main(); + } } diff --git a/example/simple-client.c b/example/simple-client.c index 6d67955..fbea377 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -7,16 +7,16 @@ Copyright 2009 Canonical Ltd. Authors: Ted Gould -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License along +You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -167,7 +167,7 @@ main (int argc, char ** argv) app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); app_indicator_set_attention_icon_full(ci, "indicator-messages-new", "System Messages Icon Highlighted"); app_indicator_set_label (ci, "1%", "100%"); - app_indicator_set_title (ci, "Test Inidcator"); + app_indicator_set_title (ci, "Test Inidcator"); g_signal_connect (ci, "scroll-event", G_CALLBACK (scroll_event_cb), NULL); -- cgit v1.2.3 From 44a82a050cf69f8b04429f1f7e06d3ad7bf58ca7 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 14 Jul 2022 23:38:23 +0200 Subject: Fix remaining deprecation warnings --- .../vala/examples/ayatana-indicator-example.vala | 4 ++- docs/reference/scangobj.sh.in | 2 +- example/simple-client-vala.vala | 21 ++++++++++----- example/simple-client.c | 30 +++++++++++++++++++--- src/application-service-marshal.list | 26 ++++++++++--------- 5 files changed, 59 insertions(+), 24 deletions(-) (limited to 'example') diff --git a/bindings/vala/examples/ayatana-indicator-example.vala b/bindings/vala/examples/ayatana-indicator-example.vala index 4804314..55535ab 100644 --- a/bindings/vala/examples/ayatana-indicator-example.vala +++ b/bindings/vala/examples/ayatana-indicator-example.vala @@ -1,5 +1,6 @@ /* * Copyright 2011 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -15,6 +16,7 @@ * * Authors: * Marco Trevisan (TreviƱo) + * Robert Tari */ using Gtk; @@ -37,7 +39,7 @@ public class IndicatorExample { if (!(indicator is Indicator)) return -1; indicator.set_status(IndicatorStatus.ACTIVE); - indicator.set_attention_icon("indicator-messages-new"); + indicator.set_attention_icon_full("indicator-messages-new", null); var menu = new Gtk.Menu(); diff --git a/docs/reference/scangobj.sh.in b/docs/reference/scangobj.sh.in index 8cb2500..1863f61 100644 --- a/docs/reference/scangobj.sh.in +++ b/docs/reference/scangobj.sh.in @@ -1 +1 @@ -LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${CMAKE_BINARY_DIR}/src" CFLAGS="-I${GTKDOC_SCANGOBJ_INCLUDE_DIRS}" LDFLAGS="-l${GTKDOC_SCANGOBJ_LIBRARIES} -L${CMAKE_BINARY_DIR}/src -l${SCANGOBJ_AYATANA_APPINDICATOR}" gtkdoc-scangobj --type-init-func="g_type_init()" --module=libayatana-appindicator > /dev/null +LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${CMAKE_BINARY_DIR}/src" CFLAGS="-I${GTKDOC_SCANGOBJ_INCLUDE_DIRS}" LDFLAGS="-l${GTKDOC_SCANGOBJ_LIBRARIES} -L${CMAKE_BINARY_DIR}/src -l${SCANGOBJ_AYATANA_APPINDICATOR}" gtkdoc-scangobj --module=libayatana-appindicator > /dev/null diff --git a/example/simple-client-vala.vala b/example/simple-client-vala.vala index 510056a..5b3af11 100644 --- a/example/simple-client-vala.vala +++ b/example/simple-client-vala.vala @@ -3,9 +3,11 @@ A small piece of sample code demonstrating a very simple application with an indicator. Copyright 2011 Canonical Ltd. +Copyright 2022 Robert Tari Authors: Marco Trevisan + Robert Tari This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published @@ -44,7 +46,7 @@ class SimpleClient { IndicatorCategory.APPLICATION_STATUS); ci.set_status(IndicatorStatus.ACTIVE); - ci.set_attention_icon("indicator-messages-new"); + ci.set_attention_icon_full("indicator-messages-new", null); ci.set_label("1%", "100%"); ci.set_title("Test Indicator (vala)"); @@ -135,10 +137,17 @@ class SimpleClient { menu.append(toggle_item); toggle_item.show(); - var imgitem = new Gtk.ImageMenuItem.from_stock(Stock.NEW, null); + var pImage = new Gtk.Image.from_icon_name("document-new", IconSize.MENU); + var pLabel = new Gtk.Label("New"); + var pGrid = new Gtk.Grid(); + pGrid.add(pImage); + pGrid.add(pLabel); + var imgitem = new Gtk.MenuItem(); + imgitem.add(pGrid); imgitem.activate.connect(() => { - Image img = (Image) imgitem.get_image(); - img.set_from_stock(Stock.OPEN, IconSize.MENU); + Grid pGridLocal = (Grid)imgitem.get_children().nth_data(0); + Image img = (Image) pGridLocal.get_children().nth_data(1); + img.set_from_icon_name("document-open", IconSize.MENU); }); menu.append(imgitem); imgitem.show(); @@ -167,9 +176,9 @@ class SimpleClient { var icon = new Gtk.CheckMenuItem.with_label("Set Local Icon"); icon.activate.connect(() => { if (icon.get_active()) { - ci.set_icon("simple-client-test-icon.png"); + ci.set_icon_full("simple-client-test-icon.png", null); } else { - ci.set_icon("indicator-messages"); + ci.set_icon_full("indicator-messages", null); } }); menu.append(icon); diff --git a/example/simple-client.c b/example/simple-client.c index fbea377..9155257 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -3,9 +3,11 @@ A small piece of sample code demonstrating a very simple application with an indicator. Copyright 2009 Canonical Ltd. +Copyright 2022 Robert Tari Authors: Ted Gould + Robert Tari This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published @@ -92,9 +94,15 @@ toggle_sensitivity_cb (GtkWidget *widget, gpointer data) static void image_clicked_cb (GtkWidget *widget, gpointer data) { - gtk_image_set_from_stock (GTK_IMAGE (gtk_image_menu_item_get_image ( - GTK_IMAGE_MENU_ITEM (widget))), - GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); + GList *pList = gtk_container_get_children(GTK_CONTAINER(widget)); + GtkContainer *pContainer = GTK_CONTAINER(g_list_nth_data(pList, 0)); + pList = gtk_container_get_children(pContainer); +#if GTK_MAJOR_VERSION >= 3 + GtkImage *pImage = GTK_IMAGE(g_list_nth_data(pList, 1)); +#else + GtkImage *pImage = GTK_IMAGE(g_list_nth_data(pList, 0)); +#endif + gtk_image_set_from_icon_name(pImage, "document-open", GTK_ICON_SIZE_MENU); } static void @@ -198,7 +206,21 @@ main (int argc, char ** argv) gtk_menu_shell_append (GTK_MENU_SHELL (menu), toggle_item); gtk_widget_show(toggle_item); - item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); + GtkWidget *pImage = gtk_image_new_from_icon_name("document-new", GTK_ICON_SIZE_MENU); + GtkWidget *pLabel = gtk_label_new("New"); +#if GTK_MAJOR_VERSION >= 3 + GtkWidget *pGrid = gtk_grid_new(); + gtk_container_add(GTK_CONTAINER(pGrid), pImage); + gtk_container_add(GTK_CONTAINER(pGrid), pLabel); + item = gtk_menu_item_new(); + gtk_container_add(GTK_CONTAINER(item), pGrid); +#else + GtkWidget *pBox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(pBox), pImage, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(pBox), pLabel, FALSE, FALSE, 0); + item = gtk_menu_item_new(); + gtk_container_add(GTK_CONTAINER(item), pBox); +#endif g_signal_connect (item, "activate", G_CALLBACK (image_clicked_cb), NULL); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); diff --git a/src/application-service-marshal.list b/src/application-service-marshal.list index 7b62a21..b6dc87a 100644 --- a/src/application-service-marshal.list +++ b/src/application-service-marshal.list @@ -1,25 +1,27 @@ # Marshaller definitions to be generated. -# +# # Copyright 2009 Canonical Ltd. -# +# Copyright 2022 Robert Tari +# # Authors: # Ted Gould -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 3, as published +# Robert Tari +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranties of -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranties of +# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along +# +# You should have received a copy of the GNU General Public License along # with this program. If not, see . VOID: STRING, INT, STRING, STRING, STRING, STRING, STRING VOID: INT, STRING, STRING VOID: INT, STRING VOID: STRING, STRING -VOID: BOOL, STRING, OBJECT +VOID: BOOLEAN, STRING, OBJECT VOID: INT, UINT VOID: INT, INT -- cgit v1.2.3 From d305bdac70063c544e5893798ca9569a1903f53b Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 15 Jul 2022 00:53:48 +0200 Subject: Silence warnings generated by Vala --- bindings/vala/examples/CMakeLists.txt | 2 +- example/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'example') diff --git a/bindings/vala/examples/CMakeLists.txt b/bindings/vala/examples/CMakeLists.txt index b747208..2751096 100644 --- a/bindings/vala/examples/CMakeLists.txt +++ b/bindings/vala/examples/CMakeLists.txt @@ -21,7 +21,7 @@ add_custom_command( # ayatana-indicator-example -set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example.c" PROPERTIES COMPILE_FLAGS " -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h") +set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example.c" PROPERTIES COMPILE_FLAGS " -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h -Wno-incompatible-pointer-types") add_executable("ayatana-indicator-example" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example.c") target_include_directories("ayatana-indicator-example" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) target_link_libraries("ayatana-indicator-example" "${PROJECT_DEPS_LIBRARIES} -layatana-appindicator3 -L${CMAKE_BINARY_DIR}/src") diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index a337cdc..0b5f133 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -31,7 +31,7 @@ if (FLAVOUR_GTK3) # simple-client-vala - set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/simple-client-vala.c" PROPERTIES COMPILE_FLAGS " -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h") + set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/simple-client-vala.c" PROPERTIES COMPILE_FLAGS " -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h -Wno-incompatible-pointer-types -Wno-unused-but-set-variable") add_executable("simple-client-vala" "${CMAKE_CURRENT_BINARY_DIR}/simple-client-vala.c") target_include_directories("simple-client-vala" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) target_link_libraries("simple-client-vala" "${PROJECT_DEPS_LIBRARIES} -l${ayatana_appindicator_gtkver} -L${CMAKE_BINARY_DIR}/src") -- cgit v1.2.3 From 694ab4eec294a93358f78a349c6df94c3b666126 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 15 Jul 2022 23:37:01 +0200 Subject: Fix all remaining build warnings --- bindings/vala/ayatana-appindicator-0.1-custom.vala | 9 ++- .../reference/libayatana-appindicator-sections.txt | 4 +- example/simple-client.c | 2 +- src/app-indicator.c | 68 +++++++++++----------- src/app-indicator.h | 8 +-- 5 files changed, 47 insertions(+), 44 deletions(-) (limited to 'example') diff --git a/bindings/vala/ayatana-appindicator-0.1-custom.vala b/bindings/vala/ayatana-appindicator-0.1-custom.vala index 9fa51eb..4cf9e3e 100644 --- a/bindings/vala/ayatana-appindicator-0.1-custom.vala +++ b/bindings/vala/ayatana-appindicator-0.1-custom.vala @@ -1,5 +1,6 @@ /* - Copyright (C) 2011 Canonical, Ltd. + Copyright 2011 Canonical, Ltd. + Copyright 2022 Robert Tari This program is free software: you can redistribute it and/or modify it under the terms of either or both of the following licenses: @@ -19,11 +20,13 @@ License version 3 and version 2.1 along with this program. If not, see - Authored by Michal Hruby + Authors: + Michal Hruby + Robert Tari */ namespace AppIndicator { - [CCode (type_check_function = "IS_APP_INDICATOR", type_id = "app_indicator_get_type ()")] + [CCode (type_check_function = "APP_IS_INDICATOR", type_id = "app_indicator_get_type ()")] public class Indicator : GLib.Object { } } diff --git a/docs/reference/libayatana-appindicator-sections.txt b/docs/reference/libayatana-appindicator-sections.txt index 3bed826..ab86216 100644 --- a/docs/reference/libayatana-appindicator-sections.txt +++ b/docs/reference/libayatana-appindicator-sections.txt @@ -3,8 +3,8 @@ APP_INDICATOR_TYPE APP_INDICATOR APP_INDICATOR_CLASS -IS_APP_INDICATOR -IS_APP_INDICATOR_CLASS +APP_IS_INDICATOR +APP_IS_INDICATOR_CLASS APP_INDICATOR_GET_CLASS APP_INDICATOR_SIGNAL_NEW_ICON APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON diff --git a/example/simple-client.c b/example/simple-client.c index 9155257..78a560d 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -169,7 +169,7 @@ main (int argc, char ** argv) "indicator-messages", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - g_assert (IS_APP_INDICATOR (ci)); + g_assert (APP_IS_INDICATOR (ci)); g_assert (G_IS_OBJECT (ci)); app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); diff --git a/src/app-indicator.c b/src/app-indicator.c index ba05871..70c7536 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -1159,7 +1159,7 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data) { - g_return_if_fail(IS_APP_INDICATOR(user_data)); + g_return_if_fail(APP_IS_INDICATOR(user_data)); AppIndicator * app = APP_INDICATOR(user_data); AppIndicatorPrivate * priv = app_indicator_get_instance_private(app); @@ -1206,7 +1206,7 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, static GVariant * bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * property, GError ** error, gpointer user_data) { - g_return_val_if_fail(IS_APP_INDICATOR(user_data), NULL); + g_return_val_if_fail(APP_IS_INDICATOR(user_data), NULL); AppIndicator * app = APP_INDICATOR(user_data); AppIndicatorPrivate *priv = app_indicator_get_instance_private(app); @@ -1411,7 +1411,7 @@ register_service_cb (GObject * obj, GAsyncResult * res, gpointer user_data) return; } - g_return_if_fail(IS_APP_INDICATOR(user_data)); + g_return_if_fail(APP_IS_INDICATOR(user_data)); AppIndicator * app = APP_INDICATOR(user_data); AppIndicatorPrivate * priv = app_indicator_get_instance_private(app); @@ -1448,7 +1448,7 @@ category_from_enum (AppIndicatorCategory category) static void start_fallback_timer (AppIndicator * self, gboolean disable_timeout) { - g_return_if_fail(IS_APP_INDICATOR(self)); + g_return_if_fail(APP_IS_INDICATOR(self)); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); if (priv->fallback_timer != 0) { @@ -1476,7 +1476,7 @@ start_fallback_timer (AppIndicator * self, gboolean disable_timeout) static gboolean fallback_timer_expire (gpointer data) { - g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE); + g_return_val_if_fail(APP_IS_INDICATOR(data), FALSE); AppIndicator * app = APP_INDICATOR(data); AppIndicatorPrivate * priv = app_indicator_get_instance_private(app); @@ -1574,7 +1574,7 @@ status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer static gboolean scroll_event_wrapper (GtkWidget *status_icon, GdkEventScroll *event, gpointer data) { - g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE); + g_return_val_if_fail(APP_IS_INDICATOR(data), FALSE); AppIndicator * app = APP_INDICATOR(data); g_signal_emit(app, signals[SCROLL_EVENT], 0, 1, event->direction); @@ -1584,7 +1584,7 @@ scroll_event_wrapper (GtkWidget *status_icon, GdkEventScroll *event, gpointer da static gboolean middle_click_wrapper (GtkWidget *status_icon, GdkEventButton *event, gpointer data) { - g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE); + g_return_val_if_fail(APP_IS_INDICATOR(data), FALSE); AppIndicator * app = APP_INDICATOR(data); AppIndicatorPrivate *priv = app_indicator_get_instance_private(app); @@ -1762,7 +1762,7 @@ append_panel_icon_suffix (const gchar *icon_name) static gboolean widget_is_menu_child(AppIndicator * self, GtkWidget *child) { - g_return_val_if_fail(IS_APP_INDICATOR(self), FALSE); + g_return_val_if_fail(APP_IS_INDICATOR(self), FALSE); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); if (!priv->menu) return FALSE; @@ -1787,7 +1787,7 @@ static void sec_activate_target_parent_changed(GtkWidget *menuitem, GtkWidget *old_parent, gpointer data) { - g_return_if_fail(IS_APP_INDICATOR(data)); + g_return_if_fail(APP_IS_INDICATOR(data)); AppIndicator *self = APP_INDICATOR(data); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); priv->sec_activate_enabled = widget_is_menu_child(self, menuitem); @@ -1872,7 +1872,7 @@ app_indicator_new_with_path (const gchar *id, void app_indicator_set_status (AppIndicator *self, AppIndicatorStatus status) { - g_return_if_fail (IS_APP_INDICATOR (self)); + g_return_if_fail (APP_IS_INDICATOR (self)); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); if (priv->status != status) { @@ -1929,7 +1929,7 @@ app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) void app_indicator_set_attention_icon_full (AppIndicator *self, const gchar *icon_name, const gchar * icon_desc) { - g_return_if_fail (IS_APP_INDICATOR (self)); + g_return_if_fail (APP_IS_INDICATOR (self)); g_return_if_fail (icon_name != NULL); gboolean changed = FALSE; @@ -2011,7 +2011,7 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) void app_indicator_set_icon_full (AppIndicator *self, const gchar *icon_name, const gchar * icon_desc) { - g_return_if_fail (IS_APP_INDICATOR (self)); + g_return_if_fail (APP_IS_INDICATOR (self)); g_return_if_fail (icon_name != NULL); gboolean changed = FALSE; @@ -2080,7 +2080,7 @@ app_indicator_set_icon_full (AppIndicator *self, const gchar *icon_name, const g void app_indicator_set_label (AppIndicator *self, const gchar * label, const gchar * guide) { - g_return_if_fail (IS_APP_INDICATOR (self)); + g_return_if_fail (APP_IS_INDICATOR (self)); /* Note: The label can be NULL, it's okay */ /* Note: The guide can be NULL, it's okay */ @@ -2162,7 +2162,7 @@ get_real_theme_path (AppIndicator * self) void app_indicator_set_icon_theme_path (AppIndicator *self, const gchar *icon_theme_path) { - g_return_if_fail (IS_APP_INDICATOR (self)); + g_return_if_fail (APP_IS_INDICATOR (self)); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); if (g_strcmp0 (priv->icon_theme_path, icon_theme_path) != 0) { @@ -2244,7 +2244,7 @@ setup_dbusmenu (AppIndicator *self) void app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) { - g_return_if_fail (IS_APP_INDICATOR (self)); + g_return_if_fail (APP_IS_INDICATOR (self)); g_return_if_fail (GTK_IS_MENU (menu)); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); @@ -2282,7 +2282,7 @@ app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) void app_indicator_set_ordering_index (AppIndicator *self, guint32 ordering_index) { - g_return_if_fail (IS_APP_INDICATOR (self)); + g_return_if_fail (APP_IS_INDICATOR (self)); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); @@ -2308,7 +2308,7 @@ app_indicator_set_ordering_index (AppIndicator *self, guint32 ordering_index) void app_indicator_set_secondary_activate_target (AppIndicator *self, GtkWidget *menuitem) { - g_return_if_fail (IS_APP_INDICATOR (self)); + g_return_if_fail (APP_IS_INDICATOR (self)); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); if (priv->sec_activate_target) { @@ -2351,7 +2351,7 @@ app_indicator_set_secondary_activate_target (AppIndicator *self, GtkWidget *menu void app_indicator_set_title (AppIndicator *self, const gchar * title) { - g_return_if_fail (IS_APP_INDICATOR (self)); + g_return_if_fail (APP_IS_INDICATOR (self)); g_object_set(G_OBJECT(self), PROP_TITLE_S, title == NULL ? "": title, @@ -2371,7 +2371,7 @@ app_indicator_set_title (AppIndicator *self, const gchar * title) const gchar * app_indicator_get_id (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->id; @@ -2388,7 +2388,7 @@ app_indicator_get_id (AppIndicator *self) AppIndicatorCategory app_indicator_get_category (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), APP_INDICATOR_CATEGORY_APPLICATION_STATUS); + g_return_val_if_fail (APP_IS_INDICATOR (self), APP_INDICATOR_CATEGORY_APPLICATION_STATUS); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->category; @@ -2405,7 +2405,7 @@ app_indicator_get_category (AppIndicator *self) AppIndicatorStatus app_indicator_get_status (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), APP_INDICATOR_STATUS_PASSIVE); + g_return_val_if_fail (APP_IS_INDICATOR (self), APP_INDICATOR_STATUS_PASSIVE); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->status; @@ -2422,7 +2422,7 @@ app_indicator_get_status (AppIndicator *self) const gchar * app_indicator_get_icon (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->icon_name; @@ -2439,7 +2439,7 @@ app_indicator_get_icon (AppIndicator *self) const gchar * app_indicator_get_icon_desc (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->accessible_desc; @@ -2456,7 +2456,7 @@ app_indicator_get_icon_desc (AppIndicator *self) const gchar * app_indicator_get_icon_theme_path (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->icon_theme_path; @@ -2473,7 +2473,7 @@ app_indicator_get_icon_theme_path (AppIndicator *self) const gchar * app_indicator_get_attention_icon (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->attention_icon_name; @@ -2490,7 +2490,7 @@ app_indicator_get_attention_icon (AppIndicator *self) const gchar * app_indicator_get_attention_icon_desc (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->att_accessible_desc; @@ -2511,7 +2511,7 @@ app_indicator_get_attention_icon_desc (AppIndicator *self) const gchar * app_indicator_get_title (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->title; } @@ -2529,7 +2529,7 @@ app_indicator_get_title (AppIndicator *self) GtkMenu * app_indicator_get_menu (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); @@ -2547,7 +2547,7 @@ app_indicator_get_menu (AppIndicator *self) const gchar * app_indicator_get_label (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->label; @@ -2564,7 +2564,7 @@ app_indicator_get_label (AppIndicator *self) const gchar * app_indicator_get_label_guide (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return priv->label_guide; @@ -2581,7 +2581,7 @@ app_indicator_get_label_guide (AppIndicator *self) guint32 app_indicator_get_ordering_index (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), 0); + g_return_val_if_fail (APP_IS_INDICATOR (self), 0); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); if (priv->ordering_index == 0) { @@ -2602,7 +2602,7 @@ app_indicator_get_ordering_index (AppIndicator *self) GtkWidget * app_indicator_get_secondary_activate_target (AppIndicator *self) { - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + g_return_val_if_fail (APP_IS_INDICATOR (self), NULL); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); return GTK_WIDGET(priv->sec_activate_target); @@ -2618,7 +2618,7 @@ shorty_activated_cb (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data) gchar * nick = g_object_get_data(G_OBJECT(mi), APP_INDICATOR_SHORTY_NICK); g_return_if_fail(nick != NULL); - g_return_if_fail(IS_APP_INDICATOR(user_data)); + g_return_if_fail(APP_IS_INDICATOR(user_data)); AppIndicator * self = APP_INDICATOR(user_data); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); @@ -2641,7 +2641,7 @@ shorty_activated_cb (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data) void app_indicator_build_menu_from_desktop (AppIndicator * self, const gchar * desktop_file, const gchar * desktop_profile) { - g_return_if_fail(IS_APP_INDICATOR(self)); + g_return_if_fail(APP_IS_INDICATOR(self)); AppIndicatorPrivate * priv = app_indicator_get_instance_private(self); /* Build a new shortcuts object */ diff --git a/src/app-indicator.h b/src/app-indicator.h index 1532b91..c1bc9d6 100644 --- a/src/app-indicator.h +++ b/src/app-indicator.h @@ -52,13 +52,13 @@ G_BEGIN_DECLS * Safely convert a #GObjectClass into a #AppIndicatorClass. */ /** - * IS_APP_INDICATOR: + * APP_IS_INDICATOR: * @obj: An #GObject to check * * Checks to see if @obj is in the object hierarchy of #AppIndicator. */ /** - * IS_APP_INDICATOR_CLASS: + * APP_IS_INDICATOR_CLASS: * @klass: An #GObjectClass to check * * Checks to see if @klass is in the object class hierarchy of #AppIndicatorClass. @@ -73,8 +73,8 @@ G_BEGIN_DECLS #define APP_INDICATOR_TYPE (app_indicator_get_type ()) #define APP_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APP_INDICATOR_TYPE, AppIndicator)) #define APP_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), APP_INDICATOR_TYPE, AppIndicatorClass)) -#define IS_APP_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APP_INDICATOR_TYPE)) -#define IS_APP_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APP_INDICATOR_TYPE)) +#define APP_IS_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), APP_INDICATOR_TYPE)) +#define APP_IS_INDICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), APP_INDICATOR_TYPE)) #define APP_INDICATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APP_INDICATOR_TYPE, AppIndicatorClass)) /** -- cgit v1.2.3