fix some warnings

Sun, 06 Dec 2020 14:41:37 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 06 Dec 2020 14:41:37 +0100
changeset 164
1d912f78fd1d
parent 163
b70e2a77dea0
child 165
3f32db79a76e

fix some warnings

application/main.c file | annotate | diff | comparison | revisions
ui/common/context.c file | annotate | diff | comparison | revisions
ui/gtk/dnd.c file | annotate | diff | comparison | revisions
ui/gtk/entry.c file | annotate | diff | comparison | revisions
ui/gtk/menu.c file | annotate | diff | comparison | revisions
ui/gtk/model.c file | annotate | diff | comparison | revisions
ui/gtk/toolkit.h file | annotate | diff | comparison | revisions
--- a/application/main.c	Sat Dec 05 17:50:22 2020 +0100
+++ b/application/main.c	Sun Dec 06 14:41:37 2020 +0100
@@ -42,7 +42,7 @@
 
 
 void action_menu(UiEvent *event, void *userdata) {
-    
+    printf("action_menu: %s\n", (char*)userdata);
 }
 
 void action_button(UiEvent *event, void *userdata) {
@@ -93,8 +93,8 @@
     ui_onstartup(application_startup, NULL);
     
     // menu
-    ui_menu("File");
-    ui_menuitem("Hello", action_menu, NULL);
+    ui_menu("_File");
+    ui_menuitem("_Hello", action_menu, NULL);
     ui_submenu("Submenu1");
     ui_submenu("Submenu2");
     ui_menuitem("item2", action_menu, NULL);
--- a/ui/common/context.c	Sat Dec 05 17:50:22 2020 +0100
+++ b/ui/common/context.c	Sun Dec 06 14:41:37 2020 +0100
@@ -188,6 +188,7 @@
 void* uic_create_value(UiContext *ctx, UiVarType type) {
     void *val = NULL;
     switch(type) {
+        case UI_VAR_SPECIAL: break;
         case UI_VAR_INTEGER: {
             val = ui_int_new(ctx, NULL);
             break;
@@ -305,6 +306,7 @@
 
 void uic_unbind_var(UiVar *var) {
     switch(var->type) {
+        case UI_VAR_SPECIAL: break;
         case UI_VAR_INTEGER: uic_int_unbind(var->value); break;
         case UI_VAR_DOUBLE: uic_double_unbind(var->value); break;
         case UI_VAR_STRING: uic_string_unbind(var->value); break;
--- a/ui/gtk/dnd.c	Sat Dec 05 17:50:22 2020 +0100
+++ b/ui/gtk/dnd.c	Sun Dec 06 14:41:37 2020 +0100
@@ -56,7 +56,8 @@
 #endif
 
 void ui_selection_settext(UiSelection *sel, char *str, int len) {
-    if(!gtk_selection_data_set_text(sel->data, str, len));
+    // TODO: handle error?
+    gtk_selection_data_set_text(sel->data, str, len);
 }
 
 void ui_selection_seturis(UiSelection *sel, char **uris, int nelm) {
--- a/ui/gtk/entry.c	Sat Dec 05 17:50:22 2020 +0100
+++ b/ui/gtk/entry.c	Sun Dec 06 14:41:37 2020 +0100
@@ -95,6 +95,7 @@
         double value = 0;
         UiObserver **obs = NULL;
         switch(type) {
+            default: break;
             case UI_VAR_INTEGER: {
                 UiInteger *i = var->value;
                 i->get = ui_spinbutton_getint;
--- a/ui/gtk/menu.c	Sat Dec 05 17:50:22 2020 +0100
+++ b/ui/gtk/menu.c	Sun Dec 06 14:41:37 2020 +0100
@@ -221,7 +221,7 @@
     UiMenu *menu = (UiMenu*)item;
     
     GtkWidget *menu_widget = gtk_menu_new();
-    GtkWidget *menu_item = gtk_menu_item_new_with_label(menu->label);
+    GtkWidget *menu_item = gtk_menu_item_new_with_mnemonic(menu->label);
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu_widget);
     
     UcxList *ls = menu->items;
--- a/ui/gtk/model.c	Sat Dec 05 17:50:22 2020 +0100
+++ b/ui/gtk/model.c	Sun Dec 06 14:41:37 2020 +0100
@@ -136,6 +136,7 @@
 
 static GType ui_gtk_type(UiModelType type) {
     switch(type) {
+        default: break;
         case UI_STRING: return G_TYPE_STRING;
         case UI_INTEGER: return G_TYPE_INT;
     }
@@ -144,6 +145,7 @@
 
 static void ui_model_set_value(GType type, void *data, GValue *value) {
     switch(type) {
+        default: break;
         case G_TYPE_OBJECT: {
             value->g_type = G_TYPE_OBJECT;
             g_value_set_object(value, data);
--- a/ui/gtk/toolkit.h	Sat Dec 05 17:50:22 2020 +0100
+++ b/ui/gtk/toolkit.h	Sun Dec 06 14:41:37 2020 +0100
@@ -36,6 +36,8 @@
 #ifdef	__cplusplus
 extern "C" {
 #endif
+    
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
 
 typedef struct UiEventData {
     UiObject    *obj;

mercurial