[planner: 1/2] Fix deprecated g_type_class_add_private()
- From: Alexandre Franke <afranke src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [planner: 1/2] Fix deprecated g_type_class_add_private()
- Date: Wed, 13 Feb 2019 17:23:56 +0000 (UTC)
commit 417231b10b28172c780510ac66b43dd687ac802e
Author: Andrew Miloradovsky <andrew interpretmath pw>
Date: Wed Feb 6 11:27:25 2019 +0000
Fix deprecated g_type_class_add_private()
README | 2 +-
configure.ac | 2 +-
src/planner-popup-button.c | 28 ++++++++++++----------------
src/planner-task-date-widget.c | 37 ++++++++++++++++---------------------
4 files changed, 30 insertions(+), 39 deletions(-)
---
diff --git a/README b/README
index 09066e6..8c1a323 100644
--- a/README
+++ b/README
@@ -56,7 +56,7 @@ Installation
Dependencies:
-GLIB 2.36.0
+GLIB 2.38.0
GTK 2.24.0
LIBGNOMECANVAS 2.10.0
LIBGLADE 2.3.0
diff --git a/configure.ac b/configure.ac
index e22b23e..9cba97a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,7 +65,7 @@ dnl ==========================================================================
dnl If you add a version number here, you *must* add an AC_SUBST line for
dnl it too, or it will never make it into the spec file!
-GLIB_REQUIRED=2.36.0
+GLIB_REQUIRED=2.38.0
GTK_REQUIRED=2.24.0
LIBGNOMECANVAS_REQUIRED=2.10.0
LIBGLADE_REQUIRED=2.3.0
diff --git a/src/planner-popup-button.c b/src/planner-popup-button.c
index df317ed..ec4a389 100644
--- a/src/planner-popup-button.c
+++ b/src/planner-popup-button.c
@@ -29,7 +29,7 @@
typedef struct {
GtkWidget *popup_window;
GtkWidget *popup_widget;
-} PlannerPopupButtonPriv;
+} PlannerPopupButtonPrivate;
static gboolean popup_button_press_event_cb (GtkWidget *popup_window,
GdkEventButton *event,
@@ -39,10 +39,9 @@ static void popup_button_popup (PlannerPopupButton *button);
static void popup_button_popdown (PlannerPopupButton *button,
gboolean ok);
-
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PLANNER_TYPE_POPUP_BUTTON,
PlannerPopupButtonPriv))
-
-G_DEFINE_TYPE (PlannerPopupButton, planner_popup_button, GTK_TYPE_TOGGLE_BUTTON);
+G_DEFINE_TYPE_WITH_PRIVATE (PlannerPopupButton,
+ planner_popup_button,
+ GTK_TYPE_TOGGLE_BUTTON);
/* Signals */
enum {
@@ -68,7 +67,6 @@ planner_popup_button_class_init (PlannerPopupButtonClass *klass)
NULL, NULL,
planner_marshal_OBJECT__VOID,
GTK_TYPE_WIDGET, 0);
-
signals[POPDOWN] = g_signal_new ("popdown",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -77,16 +75,14 @@ planner_popup_button_class_init (PlannerPopupButtonClass *klass)
planner_marshal_VOID__OBJECT_BOOLEAN,
G_TYPE_NONE, 2,
GTK_TYPE_WIDGET, G_TYPE_BOOLEAN);
-
- g_type_class_add_private (klass, sizeof (PlannerPopupButtonPriv));
}
static void
planner_popup_button_init (PlannerPopupButton *button)
{
- PlannerPopupButtonPriv *priv;
+ PlannerPopupButtonPrivate *priv;
- priv = GET_PRIV (button);
+ priv = planner_popup_button_get_instance_private (button);
priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_resizable (GTK_WINDOW (priv->popup_window), FALSE);
@@ -191,14 +187,14 @@ popup_button_position (PlannerPopupButton *button,
gint *x,
gint *y)
{
- PlannerPopupButtonPriv *priv;
+ PlannerPopupButtonPrivate *priv;
GtkWidget *button_widget;
GtkRequisition popup_req;
GdkScreen *screen;
gint monitor_num;
GdkRectangle monitor;
- priv = GET_PRIV (button);
+ priv = planner_popup_button_get_instance_private (button);
button_widget = GTK_WIDGET (button);
@@ -238,10 +234,10 @@ popup_button_position (PlannerPopupButton *button,
static void
popup_button_popup (PlannerPopupButton *button)
{
- PlannerPopupButtonPriv *priv;
+ PlannerPopupButtonPrivate *priv;
gint x, y;
- priv = GET_PRIV (button);
+ priv = planner_popup_button_get_instance_private (button);
if (priv->popup_widget) {
return;
@@ -273,9 +269,9 @@ static void
popup_button_popdown (PlannerPopupButton *button,
gboolean ok)
{
- PlannerPopupButtonPriv *priv;
+ PlannerPopupButtonPrivate *priv;
- priv = GET_PRIV (button);
+ priv = planner_popup_button_get_instance_private (button);
if (!priv->popup_widget) {
return;
diff --git a/src/planner-task-date-widget.c b/src/planner-task-date-widget.c
index 100e32f..bc711a4 100644
--- a/src/planner-task-date-widget.c
+++ b/src/planner-task-date-widget.c
@@ -35,15 +35,13 @@ typedef struct {
mrptime time;
MrpConstraintType type;
-} PlannerTaskDateWidgetPriv;
-
+} PlannerTaskDateWidgetPrivate;
static void task_date_widget_setup (PlannerTaskDateWidget *widget);
-
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PLANNER_TYPE_TASK_DATE_WIDGET,
PlannerTaskDateWidgetPriv))
-
-G_DEFINE_TYPE (PlannerTaskDateWidget, planner_task_date_widget, GTK_TYPE_FRAME);
+G_DEFINE_TYPE_WITH_PRIVATE (PlannerTaskDateWidget,
+ planner_task_date_widget,
+ GTK_TYPE_FRAME);
/* Signals */
enum {
@@ -64,7 +62,6 @@ planner_task_date_widget_class_init (PlannerTaskDateWidgetClass *klass)
NULL, NULL,
planner_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
signals[CANCELLED] = g_signal_new ("cancelled",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
@@ -72,8 +69,6 @@ planner_task_date_widget_class_init (PlannerTaskDateWidgetClass *klass)
NULL, NULL,
planner_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
- g_type_class_add_private (klass, sizeof (PlannerTaskDateWidgetPriv));
}
static void
@@ -148,10 +143,10 @@ static void
task_date_widget_combo_changed_cb (GtkComboBox *combo,
PlannerTaskDateWidget *widget)
{
- PlannerTaskDateWidgetPriv *priv;
+ PlannerTaskDateWidgetPrivate *priv;
MrpConstraintType type;
- priv = GET_PRIV (widget);
+ priv = planner_task_date_widget_get_instance_private (widget);
type = planner_task_date_widget_get_constraint_type (widget);
gtk_widget_set_sensitive (priv->calendar, type != MRP_CONSTRAINT_ASAP);
@@ -168,14 +163,14 @@ task_date_widget_combo_changed_cb (GtkComboBox *combo,
static void
task_date_widget_setup (PlannerTaskDateWidget *widget)
{
- PlannerTaskDateWidgetPriv *priv;
+ PlannerTaskDateWidgetPrivate *priv;
GladeXML *glade;
GtkWidget *vbox;
GtkWidget *root_vbox;
GtkWidget *button;
gchar *filename;
- priv = GET_PRIV (widget);
+ priv = planner_task_date_widget_get_instance_private (widget);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (widget), vbox);
@@ -225,10 +220,10 @@ task_date_widget_setup (PlannerTaskDateWidget *widget)
void
planner_task_date_widget_set_date (PlannerTaskDateWidget *widget, mrptime t)
{
- PlannerTaskDateWidgetPriv *priv;
+ PlannerTaskDateWidgetPrivate *priv;
gint year, month, day;
- priv = GET_PRIV (widget);
+ priv = planner_task_date_widget_get_instance_private (widget);
if (!mrp_time_decompose (t, &year, &month, &day, NULL, NULL, NULL)) {
return;
@@ -241,10 +236,10 @@ planner_task_date_widget_set_date (PlannerTaskDateWidget *widget, mrptime t)
mrptime
planner_task_date_widget_get_date (PlannerTaskDateWidget *widget)
{
- PlannerTaskDateWidgetPriv *priv;
+ PlannerTaskDateWidgetPrivate *priv;
gint year, month, day;
- priv = GET_PRIV (widget);
+ priv = planner_task_date_widget_get_instance_private (widget);
gtk_calendar_get_date (GTK_CALENDAR (priv->calendar),
&year, &month, &day);
@@ -257,10 +252,10 @@ void
planner_task_date_widget_set_constraint_type (PlannerTaskDateWidget *widget,
MrpConstraintType type)
{
- PlannerTaskDateWidgetPriv *priv;
+ PlannerTaskDateWidgetPrivate *priv;
gint index;
- priv = GET_PRIV (widget);
+ priv = planner_task_date_widget_get_instance_private (widget);
switch (type) {
case MRP_CONSTRAINT_ASAP:
@@ -283,10 +278,10 @@ planner_task_date_widget_set_constraint_type (PlannerTaskDateWidget *widget,
MrpConstraintType
planner_task_date_widget_get_constraint_type (PlannerTaskDateWidget *widget)
{
- PlannerTaskDateWidgetPriv *priv;
+ PlannerTaskDateWidgetPrivate *priv;
gint index;
- priv = GET_PRIV (widget);
+ priv = planner_task_date_widget_get_instance_private (widget);
index = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->combo));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]