[goffice] Implement the "combo-activate" signal in GOCombo. [#583175]
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Implement the "combo-activate" signal in GOCombo. [#583175]
- Date: Tue, 27 Apr 2010 15:50:18 +0000 (UTC)
commit a78b434c2052db19b49de6b5a2ac0eb9b79ec01e
Author: Jean Brefort <jean brefort normalesup org>
Date: Tue Apr 27 17:49:48 2010 +0200
Implement the "combo-activate" signal in GOCombo. [#583175]
ChangeLog | 12 ++++++++++++
NEWS | 1 +
configure.in | 2 +-
goffice/gtk/go-action-combo-color.c | 12 ++++++++++++
goffice/gtk/go-action-combo-pixmaps.c | 21 ++++++++++++++++++++-
goffice/gtk/go-combo-box.c | 11 +----------
goffice/gtk/go-gtk-compat.h | 17 +++++++++--------
7 files changed, 56 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ff4f907..442ee0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-04-27 Jean Brefort <jean brefort normalesup org>
+
+ * configure.in: check for gtk_widget_send_focus_changed().
+ * goffice/gtk/go-action-combo-color.c (cb_color_changed),
+ (go_action_combo_color_class_init): implement the "combo-activate" signal.
+ [#583175]
+ * goffice/gtk/go-action-combo-pixmaps.c (cb_selection_changed),
+ (go_action_combo_pixmaps_class_init): ditto.
+ * goffice/gtk/go-combo-box.c (do_focus_change): use
+ gtk_widget_send_focus_changed() when available.
+ * goffice/gtk/go-gtk-compat.h: ditto.
+
2010-04-23 Jean Brefort <jean brefort normalesup org>
* plugins/plot_distrib/gog-probability-plot.c
diff --git a/NEWS b/NEWS
index b28e323..4f90e8f 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ goffice 0.8.3:
Jean:
* Improve probability plots.
+ * Implement the "combo-activate" signal in GOCombo. [#583175]
Morten:
* Fix week numbers issue.
diff --git a/configure.in b/configure.in
index b09306d..63ca063 100644
--- a/configure.in
+++ b/configure.in
@@ -443,7 +443,7 @@ AC_CHECK_FUNCS(gtk_adjustment_get_page_size gtk_adjustment_get_upper \
gtk_tearoff_menu_item_set_torn_off gtk_widget_get_allocation gtk_widget_get_has_window \
gtk_widget_get_state gtk_widget_get_style gtk_widget_get_visible gtk_widget_get_window \
gtk_widget_has_focus gtk_widget_get_mapped gtk_widget_get_realized gtk_widget_set_can_default \
- gtk_widget_is_sensitive gtk_widget_set_can_focus gtk_widget_set_has_focus \
+ gtk_widget_is_sensitive gtk_widget_send_focus_change gtk_widget_set_can_focus \
gtk_widget_set_receives_default gtk_window_get_default_widget)
LIBS=$SAVE_LIBS
diff --git a/goffice/gtk/go-action-combo-color.c b/goffice/gtk/go-action-combo-color.c
index 2bfa126..7deab49 100644
--- a/goffice/gtk/go-action-combo-color.c
+++ b/goffice/gtk/go-action-combo-color.c
@@ -112,10 +112,12 @@ struct _GOActionComboColor {
typedef struct {
GtkActionClass base;
void (*display_custom_dialog) (GOActionComboColor *caction, GtkWidget *dialog);
+ void (*combo_activate) (GOActionComboColor *caction);
} GOActionComboColorClass;
enum {
DISPLAY_CUSTOM_DIALOG,
+ COMBO_ACTIVATE,
LAST_SIGNAL
};
@@ -148,6 +150,8 @@ cb_color_changed (GtkWidget *cc, GOColor color,
if (!by_user)
return;
caction->current_color = is_default ? caction->default_val : color;
+
+ g_signal_emit_by_name (G_OBJECT (caction), "combo-activate");
gtk_action_activate (GTK_ACTION (caction));
}
@@ -255,6 +259,14 @@ go_action_combo_color_class_init (GtkActionClass *gtk_act_class)
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
+ go_action_combo_color_signals [COMBO_ACTIVATE] =
+ g_signal_new ("combo-activate",
+ G_OBJECT_CLASS_TYPE (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GOActionComboColorClass, combo_activate),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
GSF_CLASS (GOActionComboColor, go_action_combo_color,
diff --git a/goffice/gtk/go-action-combo-pixmaps.c b/goffice/gtk/go-action-combo-pixmaps.c
index 4edc139..801802b 100644
--- a/goffice/gtk/go-action-combo-pixmaps.c
+++ b/goffice/gtk/go-action-combo-pixmaps.c
@@ -75,7 +75,17 @@ struct _GOActionComboPixmaps {
gboolean updating_proxies;
int selected_id;
};
-typedef GtkActionClass GOActionComboPixmapsClass;
+typedef struct {
+ GtkActionClass base;
+ void (*combo_activate) (GOActionComboPixmaps *paction);
+} GOActionComboPixmapsClass;
+
+enum {
+ COMBO_ACTIVATE,
+ LAST_SIGNAL
+};
+
+static guint go_action_combo_pixmaps_signals [LAST_SIGNAL] = { 0, };
static GdkPixbuf *
make_icon (GtkAction *a, const char *stock_id, GtkWidget *tool)
@@ -136,6 +146,7 @@ cb_selection_changed (GOComboPixmaps *combo, int id, GOActionComboPixmaps *pacti
go_combo_pixmaps_select_id (ptr->data, id);
paction->updating_proxies = FALSE;
+ g_signal_emit_by_name (G_OBJECT (paction), "combo-activate");
gtk_action_activate (GTK_ACTION (paction));
}
@@ -211,6 +222,14 @@ go_action_combo_pixmaps_class_init (GtkActionClass *gtk_act_klass)
gtk_act_klass->create_tool_item = go_action_combo_pixmaps_create_tool_item;
gtk_act_klass->create_menu_item = go_action_combo_pixmaps_create_menu_item;
gtk_act_klass->connect_proxy = go_action_combo_pixmaps_connect_proxy;
+ go_action_combo_pixmaps_signals [COMBO_ACTIVATE] =
+ g_signal_new ("combo-activate",
+ G_OBJECT_CLASS_TYPE (gobject_klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GOActionComboPixmapsClass, combo_activate),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
GSF_CLASS (GOActionComboPixmaps, go_action_combo_pixmaps,
diff --git a/goffice/gtk/go-combo-box.c b/goffice/gtk/go-combo-box.c
index 3454824..3b40a25 100644
--- a/goffice/gtk/go-combo-box.c
+++ b/goffice/gtk/go-combo-box.c
@@ -145,19 +145,10 @@ do_focus_change (GtkWidget *widget, gboolean in)
{
GdkEventFocus fevent;
- g_object_ref (widget);
-
- gtk_widget_set_has_focus (widget, in);
-
fevent.type = GDK_FOCUS_CHANGE;
fevent.window = gtk_widget_get_window (widget);
fevent.in = in;
-
- gtk_widget_event (widget, (GdkEvent *)&fevent);
-
- g_object_notify (G_OBJECT (widget), "has-focus");
-
- g_object_unref (widget);
+ gtk_widget_send_focus_change (widget, &fevent);
}
static void
diff --git a/goffice/gtk/go-gtk-compat.h b/goffice/gtk/go-gtk-compat.h
index 89e8690..ca63ed1 100644
--- a/goffice/gtk/go-gtk-compat.h
+++ b/goffice/gtk/go-gtk-compat.h
@@ -110,6 +110,15 @@
# define gtk_widget_is_sensitive(w) GTK_WIDGET_IS_SENSITIVE (w)
#endif
+#ifndef HAVE_GTK_WIDGET_SEND_FOCUS_CHANGED
+#define gtk_widget_send_focus_changed(w,ev) \
+ g_object_ref (widget); \
+ gtk_widget_set_has_focus (widget, in); \
+ gtk_widget_event (widget, &fevent); \
+ g_object_notify (G_OBJECT (widget), "has-focus"); \
+ g_object_unref (widget);
+#endif
+
#ifndef HAVE_GTK_WIDGET_SET_CAN_DEFAULT
#define gtk_widget_set_can_default(w,t) \
do { \
@@ -126,14 +135,6 @@
} while (0)
#endif
-#ifndef HAVE_GTK_WIDGET_SET_HAS_FOCUS
-#define gtk_widget_set_has_focus(w,t) \
- do { \
- if (t) GTK_WIDGET_SET_FLAGS ((w), GTK_HAS_FOCUS); \
- else GTK_WIDGET_UNSET_FLAGS ((w), GTK_HAS_FOCUS); \
- } while (0)
-#endif
-
#ifndef HAVE_GTK_WIDGET_SET_RECEIVES_DEFAULT
#define gtk_widget_set_receives_default(w,t) \
do { \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]