[evince/gnome3-style: 8/14] zoom-control: Add API to know if zoom dropdown menu is currently shown
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/gnome3-style: 8/14] zoom-control: Add API to know if zoom dropdown menu is currently shown
- Date: Tue, 16 Oct 2012 12:16:23 +0000 (UTC)
commit f791cb9dcebf1d3c1cbc6fa196d866daf9280697
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Sun Oct 14 12:55:58 2012 +0200
zoom-control: Add API to know if zoom dropdown menu is currently shown
cut-n-paste/zoom-control/ephy-zoom-action.c | 17 +++++++++++++
cut-n-paste/zoom-control/ephy-zoom-action.h | 1 +
cut-n-paste/zoom-control/ephy-zoom-control.c | 33 +++++++++++++++++++++++++-
cut-n-paste/zoom-control/ephy-zoom-control.h | 2 +
4 files changed, 52 insertions(+), 1 deletions(-)
---
diff --git a/cut-n-paste/zoom-control/ephy-zoom-action.c b/cut-n-paste/zoom-control/ephy-zoom-action.c
index b6250c8..42bb1d2 100644
--- a/cut-n-paste/zoom-control/ephy-zoom-action.c
+++ b/cut-n-paste/zoom-control/ephy-zoom-action.c
@@ -38,6 +38,7 @@ struct _EphyZoomActionPrivate
float zoom;
float min_zoom;
float max_zoom;
+ gboolean popup_shown;
};
enum
@@ -95,6 +96,12 @@ sync_max_zoom_cb (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
}
static void
+popup_shown_cb (EphyZoomControl *control, GParamSpec *pspec, EphyZoomAction *zoom_action)
+{
+ zoom_action->priv->popup_shown = ephy_zoom_control_get_popup_shown (control);
+}
+
+static void
connect_proxy (GtkAction *action, GtkWidget *proxy)
{
if (EPHY_IS_ZOOM_CONTROL (proxy))
@@ -107,6 +114,8 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
G_CALLBACK (sync_max_zoom_cb), proxy, 0);
g_signal_connect (proxy, "zoom_to_level",
G_CALLBACK (zoom_to_level_cb), action);
+ g_signal_connect (proxy, "notify::popup-shown",
+ G_CALLBACK (popup_shown_cb), action);
}
GTK_ACTION_CLASS (ephy_zoom_action_parent_class)->connect_proxy (action, proxy);
@@ -334,3 +343,11 @@ ephy_zoom_action_set_max_zoom_level (EphyZoomAction *action,
g_object_notify (G_OBJECT (action), "max-zoom");
}
+
+gboolean
+ephy_zoom_action_get_popup_shown (EphyZoomAction *action)
+{
+ g_return_val_if_fail (EPHY_IS_ZOOM_ACTION (action), FALSE);
+
+ return action->priv->popup_shown;
+}
diff --git a/cut-n-paste/zoom-control/ephy-zoom-action.h b/cut-n-paste/zoom-control/ephy-zoom-action.h
index cf9f6fe..a8ecfba 100644
--- a/cut-n-paste/zoom-control/ephy-zoom-action.h
+++ b/cut-n-paste/zoom-control/ephy-zoom-action.h
@@ -62,6 +62,7 @@ void ephy_zoom_action_set_min_zoom_level (EphyZoomAction *action,
float zoom);
void ephy_zoom_action_set_max_zoom_level (EphyZoomAction *action,
float zoom);
+gboolean ephy_zoom_action_get_popup_shown (EphyZoomAction *action);
G_END_DECLS
diff --git a/cut-n-paste/zoom-control/ephy-zoom-control.c b/cut-n-paste/zoom-control/ephy-zoom-control.c
index 5836a27..fa1ee21 100644
--- a/cut-n-paste/zoom-control/ephy-zoom-control.c
+++ b/cut-n-paste/zoom-control/ephy-zoom-control.c
@@ -51,7 +51,8 @@ enum
PROP_0,
PROP_ZOOM,
PROP_MIN_ZOOM,
- PROP_MAX_ZOOM
+ PROP_MAX_ZOOM,
+ PROP_POPUP_SHOWN
};
enum
@@ -130,6 +131,12 @@ sync_zoom_max_min_cb (EphyZoomControl *control, GParamSpec *pspec, gpointer data
g_signal_handler_unblock (p->combo, p->handler_id);
}
+static void
+popup_shown_cb (GtkComboBox *combo, GParamSpec *pspec, EphyZoomControl *control)
+{
+ g_object_notify (G_OBJECT (control), "popup-shown");
+}
+
static gboolean
row_is_separator (GtkTreeModel *model,
GtkTreeIter *iter,
@@ -208,6 +215,8 @@ ephy_zoom_control_init (EphyZoomControl *control)
p->handler_id = g_signal_connect (p->combo, "changed",
G_CALLBACK (combo_changed_cb), control);
+ g_signal_connect (p->combo, "notify::popup-shown",
+ G_CALLBACK (popup_shown_cb), control);
g_signal_connect_object (control, "notify::zoom",
G_CALLBACK (sync_zoom_cb), NULL, 0);
@@ -266,6 +275,9 @@ ephy_zoom_control_get_property (GObject *object,
case PROP_MAX_ZOOM:
g_value_set_float (value, p->max_zoom);
break;
+ case PROP_POPUP_SHOWN:
+ g_value_set_boolean (value, ephy_zoom_control_get_popup_shown (control));
+ break;
}
}
@@ -307,6 +319,13 @@ ephy_zoom_control_class_init (EphyZoomControlClass *klass)
ZOOM_MAXIMAL,
ZOOM_MAXIMAL,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_POPUP_SHOWN,
+ g_param_spec_boolean ("popup-shown",
+ "Popup shown",
+ "Whether the combo's dropdown is shown",
+ FALSE,
+ G_PARAM_READABLE));
signals[ZOOM_TO_LEVEL_SIGNAL] =
g_signal_new ("zoom_to_level",
@@ -341,3 +360,15 @@ ephy_zoom_control_get_zoom_level (EphyZoomControl *control)
return control->priv->zoom;
}
+
+gboolean
+ephy_zoom_control_get_popup_shown (EphyZoomControl *control)
+{
+ gboolean retval;
+
+ g_return_val_if_fail (EPHY_IS_ZOOM_CONTROL (control), FALSE);
+
+ g_object_get (control->priv->combo, "popup-shown", &retval, NULL);
+
+ return retval;
+}
diff --git a/cut-n-paste/zoom-control/ephy-zoom-control.h b/cut-n-paste/zoom-control/ephy-zoom-control.h
index 8e74e7b..c6d9bea 100644
--- a/cut-n-paste/zoom-control/ephy-zoom-control.h
+++ b/cut-n-paste/zoom-control/ephy-zoom-control.h
@@ -58,6 +58,8 @@ void ephy_zoom_control_set_zoom_level (EphyZoomControl *control, float zoom);
float ephy_zoom_control_get_zoom_level (EphyZoomControl *control);
+gboolean ephy_zoom_control_get_popup_shown (EphyZoomControl *control);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]