[Xfce4-commits] <xfce4-indicator-plugin:andrzejr/gtk3> Initial port to gtk3
Andrzej
noreply at xfce.org
Sun Apr 7 02:16:02 CEST 2013
Updating branch refs/heads/andrzejr/gtk3
to 72a3de8c1c84b89a242519e87de6f597dc5a93d3 (commit)
from c47509d7c9394329ee3dad48ef8e93751be61b67 (commit)
commit 72a3de8c1c84b89a242519e87de6f597dc5a93d3
Author: Andrzej <ndrwrdck at gmail.com>
Date: Sun Apr 7 01:15:10 2013 +0100
Initial port to gtk3
Doesn't work yet - needs a modified gtk2 xfce4-panel that loads wrapper3
on demand.
configure.in.in | 13 +++++-----
panel-plugin/Makefile.am | 2 -
panel-plugin/indicator-box.c | 46 +++++++++++++++++++++++++++++++++----
panel-plugin/indicator-button.c | 6 +++-
panel-plugin/indicator-config.c | 37 ++++++++++++++++++++---------
panel-plugin/indicator-dialog.c | 14 +++++-----
panel-plugin/indicator.desktop.in | 1 +
7 files changed, 85 insertions(+), 34 deletions(-)
diff --git a/configure.in.in b/configure.in.in
index fd7258c..6ac22dd 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -72,13 +72,14 @@ XDT_CHECK_LIBX11_REQUIRE()
dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.14.0])
-XDT_CHECK_PACKAGE([EXO], [exo-1], [0.6.0])
-XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.3.99.2])
-XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.8.0])
-XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.99.2])
+XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.6.0])
+dnl XDT_CHECK_PACKAGE([EXO], [exo-1], [0.6.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.9.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.9.0])
+XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.10.0])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.6.0])
-XDT_CHECK_PACKAGE([INDICATOR], [indicator], [0.3.0], [indicator_pkgname=indicator], [XDT_CHECK_PACKAGE([INDICATOR], [indicator-0.4], [0.3.90], [indicator_pkgname=indicator-0.4], [])])
+dnl XDT_CHECK_PACKAGE([INDICATOR], [indicator3], [0.4.0], [indicator_pkgname=indicator], [XDT_CHECK_PACKAGE([INDICATOR], [indicator3-0.4], [0.3.90], [indicator_pkgname=indicator3-0.4], [])])
+XDT_CHECK_PACKAGE([INDICATOR], [indicator3-0.4], [0.4.0])
dnl ***********************************
dnl *** Check for debugging support ***
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index fcec7f7..7eb6ac0 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -32,7 +32,6 @@ libindicator_plugin_la_SOURCES = \
libindicator_plugin_la_CFLAGS = \
$(GTK_CFLAGS) \
- $(EXO_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCE4UI_CFLAGS) \
$(LIBXFCE4PANEL_CFLAGS) \
@@ -52,7 +51,6 @@ libindicator_plugin_la_LDFLAGS = \
libindicator_plugin_la_LIBADD = \
$(GTK_LIBS) \
- $(EXO_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCE4UI_LIBS) \
$(LIBXFCE4PANEL_LIBS) \
diff --git a/panel-plugin/indicator-box.c b/panel-plugin/indicator-box.c
index c181009..6e1332f 100644
--- a/panel-plugin/indicator-box.c
+++ b/panel-plugin/indicator-box.c
@@ -26,7 +26,7 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <exo/exo.h>
+//#include <exo/exo.h>
#include <libxfce4panel/libxfce4panel.h>
#include <libindicator/indicator-object.h>
@@ -47,6 +47,12 @@ static void xfce_indicator_box_forall (GtkContainer
static GType xfce_indicator_box_child_type (GtkContainer *container);
static void xfce_indicator_box_size_request (GtkWidget *widget,
GtkRequisition *requisition);
+static void xfce_indicator_box_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width);
+static void xfce_indicator_box_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height);
static void xfce_indicator_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
@@ -91,7 +97,9 @@ xfce_indicator_box_class_init (XfceIndicatorBoxClass *klass)
gobject_class->finalize = xfce_indicator_box_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->size_request = xfce_indicator_box_size_request;
+ //gtkwidget_class->size_request = xfce_indicator_box_size_request;
+ gtkwidget_class->get_preferred_width = xfce_indicator_box_get_preferred_width;
+ gtkwidget_class->get_preferred_height = xfce_indicator_box_get_preferred_height;
gtkwidget_class->size_allocate = xfce_indicator_box_size_allocate;
gtkcontainer_class = GTK_CONTAINER_CLASS (klass);
@@ -106,8 +114,7 @@ xfce_indicator_box_class_init (XfceIndicatorBoxClass *klass)
static void
xfce_indicator_box_init (XfceIndicatorBox *box)
{
- GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW);
-
+ gtk_widget_set_has_window (GTK_WIDGET (box), FALSE);
gtk_widget_set_can_focus(GTK_WIDGET(box), TRUE);
gtk_container_set_border_width(GTK_CONTAINER(box), 0);
@@ -217,7 +224,7 @@ xfce_indicator_box_add (GtkContainer *container,
g_return_if_fail (XFCE_IS_INDICATOR_BOX (box));
g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (button));
- g_return_if_fail (child->parent == NULL);
+ g_return_if_fail (gtk_widget_get_parent (GTK_WIDGET (child)) == NULL);
io_name = xfce_indicator_button_get_io_name (button);
li = g_hash_table_lookup (box->children, io_name);
@@ -403,6 +410,35 @@ xfce_indicator_box_size_request (GtkWidget *widget,
static void
+xfce_indicator_box_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ GtkRequisition requisition;
+
+ xfce_indicator_box_size_request (widget, &requisition);
+
+ *minimal_width = *natural_width = requisition.width;
+}
+
+
+
+static void
+xfce_indicator_box_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ GtkRequisition requisition;
+
+ xfce_indicator_box_size_request (widget, &requisition);
+
+ *minimal_height = *natural_height = requisition.height;
+}
+
+
+
+
+static void
xfce_indicator_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
diff --git a/panel-plugin/indicator-button.c b/panel-plugin/indicator-button.c
index 25a3572..dd11169 100644
--- a/panel-plugin/indicator-button.c
+++ b/panel-plugin/indicator-button.c
@@ -103,7 +103,9 @@ xfce_indicator_button_class_init (XfceIndicatorButtonClass *klass)
static void
xfce_indicator_button_init (XfceIndicatorButton *button)
{
- GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (button), GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
+ //GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (button), GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(GTK_WIDGET(button), FALSE);
+ gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_use_underline (GTK_BUTTON (button),TRUE);
gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
@@ -526,7 +528,7 @@ xfce_indicator_configuration_changed (XfceIndicatorButton *button,
{
g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (button));
g_return_if_fail (XFCE_IS_INDICATOR_CONFIG (config));
- g_return_if_fail (GTK_WIDGET (button)->parent != NULL);
+ g_return_if_fail (gtk_widget_get_parent (GTK_WIDGET (button)) != NULL);
if (button->orig_icon != NULL)
xfce_indicator_button_update_icon (button);
diff --git a/panel-plugin/indicator-config.c b/panel-plugin/indicator-config.c
index d5f5cda..a560da4 100644
--- a/panel-plugin/indicator-config.c
+++ b/panel-plugin/indicator-config.c
@@ -36,7 +36,7 @@
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
#include <xfconf/xfconf.h>
-#include <exo/exo.h>
+//#include <exo/exo.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include "indicator.h"
@@ -156,32 +156,43 @@ indicator_config_class_init (IndicatorConfigClass *klass)
1,
128,
DEFAULT_ICON_SIZE_MAX,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_CONSTRUCT_ONLY));
+
g_object_class_install_property (gobject_class,
PROP_ALIGN_LEFT,
g_param_spec_boolean ("align-left", NULL, NULL,
DEFAULT_ALIGN_LEFT,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
PROP_MODE_WHITELIST,
g_param_spec_boolean ("mode-whitelist", NULL, NULL,
DEFAULT_MODE_WHITELIST,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
PROP_BLACKLIST,
g_param_spec_boxed ("blacklist",
NULL, NULL,
XFCE_TYPE_INDICATOR_CONFIG_VALUE_ARRAY,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
PROP_WHITELIST,
g_param_spec_boxed ("whitelist",
NULL, NULL,
XFCE_TYPE_INDICATOR_CONFIG_VALUE_ARRAY,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class,
@@ -189,7 +200,9 @@ indicator_config_class_init (IndicatorConfigClass *klass)
g_param_spec_boxed ("known-indicators",
NULL, NULL,
XFCE_TYPE_INDICATOR_CONFIG_VALUE_ARRAY,
- EXO_PARAM_READWRITE));
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_CONSTRUCT_ONLY));
indicator_config_signals[CONFIGURATION_CHANGED] =
@@ -584,7 +597,7 @@ indicator_config_blacklist_set (IndicatorConfig *config,
gchar *name_copy;
g_return_if_fail (XFCE_IS_INDICATOR_CONFIG (config));
- g_return_if_fail (!exo_str_is_empty (name));
+ //g_return_if_fail (!exo_str_is_empty (name));
if (add)
{
@@ -611,7 +624,7 @@ indicator_config_whitelist_set (IndicatorConfig *config,
gchar *name_copy;
g_return_if_fail (XFCE_IS_INDICATOR_CONFIG (config));
- g_return_if_fail (!exo_str_is_empty (name));
+ //g_return_if_fail (!exo_str_is_empty (name));
if (add)
{
@@ -660,7 +673,7 @@ indicator_config_add_known_indicator (IndicatorConfig *config,
GList *li;
g_return_if_fail (XFCE_IS_INDICATOR_CONFIG (config));
- g_return_if_fail (!exo_str_is_empty (name));
+ //g_return_if_fail (!exo_str_is_empty (name));
/* check if the indicator is already known */
for(li = config->known_indicators; li != NULL; li = li->next)
@@ -684,8 +697,8 @@ indicator_config_swap_known_indicators (IndicatorConfig *config,
GList *li, *li_tmp;
g_return_if_fail (XFCE_IS_INDICATOR_CONFIG (config));
- g_return_if_fail (!exo_str_is_empty (name1));
- g_return_if_fail (!exo_str_is_empty (name2));
+ //g_return_if_fail (!exo_str_is_empty (name1));
+ //g_return_if_fail (!exo_str_is_empty (name2));
for(li = config->known_indicators; li != NULL; li = li->next)
if (g_strcmp0 (li->data, name1) == 0)
diff --git a/panel-plugin/indicator-dialog.c b/panel-plugin/indicator-dialog.c
index 39280b5..71af392 100644
--- a/panel-plugin/indicator-dialog.c
+++ b/panel-plugin/indicator-dialog.c
@@ -35,7 +35,7 @@
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
-#include <exo/exo.h>
+//#include <exo/exo.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include "indicator-dialog.h"
@@ -478,18 +478,18 @@ indicator_dialog_build (IndicatorDialog *dialog)
object = gtk_builder_get_object (builder, "size-max");
g_return_if_fail (GTK_IS_WIDGET (object));
- exo_mutual_binding_new (G_OBJECT (dialog->config), "icon-size-max",
- G_OBJECT (object), "value");
+ //exo_mutual_binding_new (G_OBJECT (dialog->config), "icon-size-max",
+ // G_OBJECT (object), "value");
object = gtk_builder_get_object (builder, "checkbutton-align-left");
g_return_if_fail (GTK_IS_WIDGET (object));
- exo_mutual_binding_new (G_OBJECT (dialog->config), "align-left",
- G_OBJECT (object), "active");
+ //exo_mutual_binding_new (G_OBJECT (dialog->config), "align-left",
+ // G_OBJECT (object), "active");
object = gtk_builder_get_object (builder, "checkbutton-whitelist");
g_return_if_fail (GTK_IS_WIDGET (object));
- exo_mutual_binding_new (G_OBJECT (dialog->config), "mode-whitelist",
- G_OBJECT (object), "active");
+ //exo_mutual_binding_new (G_OBJECT (dialog->config), "mode-whitelist",
+ // G_OBJECT (object), "active");
g_signal_connect (G_OBJECT (object), "toggled",
G_CALLBACK (indicator_dialog_mode_whitelist_toggled), dialog);
indicator_dialog_mode_whitelist_toggled (GTK_CHECK_BUTTON (object), dialog);
diff --git a/panel-plugin/indicator.desktop.in b/panel-plugin/indicator.desktop.in
index b0a757d..5f722ab 100644
--- a/panel-plugin/indicator.desktop.in
+++ b/panel-plugin/indicator.desktop.in
@@ -6,3 +6,4 @@ _Comment=An indicator of something that needs your attention on the desktop
Icon=xfce4-indicator-plugin
X-XFCE-Module=indicator-plugin
X-XFCE-Internal=FALSE
+X-XFCE-Gtk3=TRUE
More information about the Xfce4-commits
mailing list