Browse Source

Déclaration du signal dans le fichier ui

Thomas Arnoux 2 tháng trước cách đây
mục cha
commit
423927b7dd
3 tập tin đã thay đổi với 17 bổ sung8 xóa
  1. 7 1
      lu.arnoux.Oupis.json
  2. 9 7
      src/oupis-window.c
  3. 1 0
      src/oupis-window.ui

+ 7 - 1
lu.arnoux.Oupis.json

@@ -32,7 +32,13 @@
                     "type" : "git",
                     "url" : "file:///home/vetetix/Projects"
                 }
+            ],
+            "config-opts" : [
+                "--libdir=lib"
             ]
         }
-    ]
+    ],
+    "build-options" : {
+        "env" : {        }
+    }
 }

+ 9 - 7
src/oupis-window.c

@@ -37,19 +37,21 @@ static void
 oupis_window__search_request (GtkSearchEntry *self,
                               gpointer        userdata)
 {
-  char* request;
+  const char* request;
   request = gtk_editable_get_text (GTK_EDITABLE (self));
   g_print ("%s\n", request);
 }
 
 static void
 oupis_window_class_init (OupisWindowClass *klass)
-  {
+{
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
   gtk_widget_class_set_template_from_resource (widget_class, "/lu/arnoux/Oupis/oupis-window.ui");
   gtk_widget_class_bind_template_child (widget_class, OupisWindow, searchentry);
   gtk_widget_class_bind_template_child (widget_class, OupisWindow, label);
+
+  gtk_widget_class_bind_template_callback (widget_class, oupis_window__search_request);
 }
 
 static void
@@ -57,10 +59,10 @@ oupis_window_init (OupisWindow *self)
 {
   gtk_widget_init_template (GTK_WIDGET (self) );
 
-  GtkSearchEntry *searchentry = GTK_SEARCH_ENTRY (self->searchentry);
-  g_signal_connect (searchentry,
-                    "activate",
-                    G_CALLBACK (oupis_window__search_request),
-                    self);
+  //GtkSearchEntry *searchentry = GTK_SEARCH_ENTRY (self->searchentry);
+  //g_signal_connect (searchentry,
+  //                 "activate",
+  //                  G_CALLBACK (oupis_window__search_request),
+  //                  self);
 
 }

+ 1 - 0
src/oupis-window.ui

@@ -14,6 +14,7 @@
               <object class="GtkSearchEntry" id="searchentry">
                 <property name="placeholder-text">Rechercher…</property>
                 <property name="margin-start">10</property>
+                <signal name="activate" handler="oupis_window__search_request"/>
               </object>
             </child>
             <child type="end">