[gnome-flashback/wip/segeiger/gnome-3-18-inputmethods: 2/2] A few fixes



commit ed1b556c5fdd5b2524b8f6a648713eec406e3ea5
Author: Sebastian Geiger <sbastig gmx net>
Date:   Tue Jan 12 20:11:36 2016 +0100

    A few fixes

 gnome-flashback/libinput-sources/Makefile.am       |    2 +
 .../libinput-sources/gf-candidate-area.c           |   12 +++--
 .../libinput-sources/gf-candidate-area.h           |    2 +-
 .../libinput-sources/gf-candidate-popup.c          |   58 ++++++++++++++++++--
 4 files changed, 64 insertions(+), 10 deletions(-)
---
diff --git a/gnome-flashback/libinput-sources/Makefile.am b/gnome-flashback/libinput-sources/Makefile.am
index e7ce173..80fb88d 100644
--- a/gnome-flashback/libinput-sources/Makefile.am
+++ b/gnome-flashback/libinput-sources/Makefile.am
@@ -15,6 +15,8 @@ libinput_sources_la_CFLAGS = \
        $(NULL)
 
 libinput_sources_la_SOURCES = \
+       gf-candidate-area.c \
+       gf-candidate-area.h \
        gf-candidate-popup.c \
        gf-candidate-popup.h \
        gf-ibus-manager.c \
diff --git a/gnome-flashback/libinput-sources/gf-candidate-area.c 
b/gnome-flashback/libinput-sources/gf-candidate-area.c
index 5d06f94..97b2932 100644
--- a/gnome-flashback/libinput-sources/gf-candidate-area.c
+++ b/gnome-flashback/libinput-sources/gf-candidate-area.c
@@ -48,6 +48,8 @@ enum
 
 static guint signals[SIGNAL_LAST] = { 0 };
 
+G_DEFINE_TYPE (GfCandidateArea, gf_candidate_area, G_TYPE_OBJECT)
+
 static gboolean
 button_clicked_cb (GtkWidget *widget,
                    GdkEvent  *event,
@@ -201,16 +203,16 @@ static void
 gf_candidate_area_class_init (GfCandidateAreaClass *area_class)
 {
   signals[SIGNAL_CANDIDATE_CLICKED] =
-    g_signal_new ("candidate_clicked", G_OBJECT_CLASS_TYPE (area_class),
+    g_signal_new ("candidate-clicked", G_OBJECT_CLASS_TYPE (area_class),
                   G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE,
-                  1, G_TYPE_INT, GDK_TYPE_EVENT);
+                  1, G_TYPE_UINT, GDK_TYPE_EVENT);
 
   signals[SIGNAL_PREV_PAGE] =
-      g_signal_new ("candidate_clicked", G_OBJECT_CLASS_TYPE (area_class),
+      g_signal_new ("previous-page", G_OBJECT_CLASS_TYPE (area_class),
                     G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
 
   signals[SIGNAL_NEXT_PAGE] =
-      g_signal_new ("candidate_clicked", G_OBJECT_CLASS_TYPE (area_class),
+      g_signal_new ("next-page", G_OBJECT_CLASS_TYPE (area_class),
                     G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 0);
 }
 
@@ -219,6 +221,8 @@ gf_candidate_area_init (GfCandidateArea *area)
 {
   int i;
 
+  area->box_layout = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+
   for (i = 0; i < MAX_CANDIDATES_PER_PAGE; i++)
     {
       GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
diff --git a/gnome-flashback/libinput-sources/gf-candidate-area.h 
b/gnome-flashback/libinput-sources/gf-candidate-area.h
index ef81709..0c862ae 100644
--- a/gnome-flashback/libinput-sources/gf-candidate-area.h
+++ b/gnome-flashback/libinput-sources/gf-candidate-area.h
@@ -20,7 +20,7 @@
 
 #include <glib-object.h>
 #include <gtk/gtk.h>
-#include <ibus.h>
+#include <ibus-1.0/ibus.h>
 
 G_BEGIN_DECLS
 
diff --git a/gnome-flashback/libinput-sources/gf-candidate-popup.c 
b/gnome-flashback/libinput-sources/gf-candidate-popup.c
index dfaa67b..94deb72 100644
--- a/gnome-flashback/libinput-sources/gf-candidate-popup.c
+++ b/gnome-flashback/libinput-sources/gf-candidate-popup.c
@@ -47,6 +47,7 @@ set_cursor_location_cb (IBusPanelService *service,
                         gint              h,
                         gpointer          user_data)
 {
+  g_message ("set_cursor_location_cb");
 }
 
 static void
@@ -56,18 +57,21 @@ update_preedit_text_cb (IBusPanelService *service,
                         gboolean          visible,
                         gpointer          user_data)
 {
+  g_message ("update_preedit_text_cb");
 }
 
 static void
 show_preedit_text_cb (IBusPanelService *service,
                       gpointer          user_data)
 {
+  g_message ("show_preedit_text_cb");
 }
 
 static void
 hide_preedit_text_cb (IBusPanelService *service,
                       gpointer          user_data)
 {
+  g_message ("hide_preedit_text_cb");
 }
 
 static void
@@ -76,18 +80,21 @@ update_auxiliary_text_cb (IBusPanelService *service,
                           gboolean          visible,
                           gpointer          user_data)
 {
+  g_message ("update_auxiliary_text_cb");
 }
 
 static void
 show_auxiliary_text_cb (IBusPanelService *service,
                         gpointer          user_data)
 {
+  g_message ("show_auxiliary_text_cb");
 }
 
 static void
 hide_auxiliary_text_cb (IBusPanelService *service,
                         gpointer          user_data)
 {
+  g_message ("hide_auxiliary_text_cb");
 }
 
 static void
@@ -96,19 +103,39 @@ update_lookup_table_cb (IBusPanelService *service,
                         gboolean          visible,
                         gpointer          user_data)
 {
-
+  //g_message ("update_lookup_table_cb");
 }
 
 static void
 show_lookup_table_cb (IBusPanelService *service,
                       gpointer          user_data)
 {
+  GfCandidatePopup *popup;
+  GtkWidget *box_layout;
+
+  g_message ("show_lookup_table_cb");
+
+  popup = GF_CANDIDATE_POPUP (user_data);
+
+  box_layout = gf_candidate_area_get_box_layout (popup->candidateArea);
+
+  gtk_widget_show (box_layout);
 }
 
 static void
 hide_lookup_table_cb (IBusPanelService *service,
                       gpointer          user_data)
 {
+  GfCandidatePopup *popup;
+  GtkWidget *box_layout;
+
+  g_message ("hide_lookup_table_cb");
+
+  popup = GF_CANDIDATE_POPUP (user_data);
+
+  box_layout = gf_candidate_area_get_box_layout (popup->candidateArea);
+
+  gtk_widget_hide (box_layout);
 }
 
 static void
@@ -116,31 +143,50 @@ focus_out_cb (IBusPanelService *service,
               const gchar      *input_context_path,
               gpointer          user_data)
 {
+  g_message ("focus_out_cb");
 }
 
 static void
 area_page_prev_cb (GfCandidateArea *area,
                    gpointer         user_data)
 {
+  GfCandidatePopup *popup;
+
+  popup = GF_CANDIDATE_POPUP (user_data);
 
+  ibus_panel_service_page_up (popup->service);
 }
 
 static void
 area_page_next_cb (GfCandidateArea *area,
                    gpointer         user_data)
 {
+  GfCandidatePopup *popup;
+
+  popup = GF_CANDIDATE_POPUP (user_data);
 
+  ibus_panel_service_page_down (popup->service);
 }
 
 static void
 area_candidate_clicked_cb (GfCandidateArea *area,
-                           gint             index,
+                           guint             index,
                            GdkEvent        *event,
-                           gpointer         user_data
-
-)
+                           gpointer         user_data)
 {
+  GfCandidatePopup *popup;
+  guint button;
+  GdkModifierType state;
+
+  popup = GF_CANDIDATE_POPUP (user_data);
 
+  gdk_event_get_button (event, &button);
+  gdk_event_get_state (event, &state);
+
+  ibus_panel_service_candidate_clicked (popup->service,
+                                        index,
+                                        button,
+                                        state);
 }
 
 static void
@@ -186,6 +232,8 @@ gf_candidate_popup_init (GfCandidatePopup *popup)
   gtk_container_add (GTK_CONTAINER (popup->box_layout),
                      gf_candidate_area_get_box_layout (popup->candidateArea));
 
+  gtk_widget_show_all (popup->box_layout);
+
   g_signal_connect (popup->candidateArea, "previous-page",
                     G_CALLBACK (area_page_prev_cb), popup);
   g_signal_connect (popup->candidateArea, "next-page",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]