[gnome-builder/wip/gtk4-port] libide/gui: remove duplication from PanelWidget
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/gui: remove duplication from PanelWidget
- Date: Sat, 2 Apr 2022 03:47:01 +0000 (UTC)
commit eaa23293225cc20a02fe1e79cd318f00969082d4
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 1 20:46:55 2022 -0700
libide/gui: remove duplication from PanelWidget
We don't need this in the subclass now that it comes from PanelWidget.
src/libide/gui/ide-page.c | 192 +---------------------------------------------
src/libide/gui/ide-page.h | 22 ------
2 files changed, 1 insertion(+), 213 deletions(-)
---
diff --git a/src/libide/gui/ide-page.c b/src/libide/gui/ide-page.c
index 397beb313..41cb33f20 100644
--- a/src/libide/gui/ide-page.c
+++ b/src/libide/gui/ide-page.c
@@ -35,9 +35,6 @@ typedef struct
GList mru_link;
const char *menu_id;
- const char *icon_name;
- char *title;
- GIcon *icon;
guint failed : 1;
guint modified : 1;
@@ -48,11 +45,7 @@ enum {
PROP_0,
PROP_CAN_SPLIT,
PROP_FAILED,
- PROP_ICON,
- PROP_ICON_NAME,
PROP_MENU_ID,
- PROP_MODIFIED,
- PROP_TITLE,
N_PROPS
};
@@ -61,7 +54,7 @@ enum {
N_SIGNALS
};
-G_DEFINE_TYPE_WITH_PRIVATE (IdePage, ide_page, PANEL_TYPE_WIDGET)
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (IdePage, ide_page, PANEL_TYPE_WIDGET)
static GParamSpec *properties [N_PROPS];
static guint signals [N_SIGNALS];
@@ -179,26 +172,10 @@ ide_page_get_property (GObject *object,
g_value_set_boolean (value, ide_page_get_failed (self));
break;
- case PROP_ICON_NAME:
- g_value_set_static_string (value, ide_page_get_icon_name (self));
- break;
-
- case PROP_ICON:
- g_value_set_object (value, ide_page_get_icon (self));
- break;
-
case PROP_MENU_ID:
g_value_set_static_string (value, ide_page_get_menu_id (self));
break;
- case PROP_MODIFIED:
- g_value_set_boolean (value, ide_page_get_modified (self));
- break;
-
- case PROP_TITLE:
- g_value_set_string (value, ide_page_get_title (self));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -222,26 +199,10 @@ ide_page_set_property (GObject *object,
ide_page_set_failed (self, g_value_get_boolean (value));
break;
- case PROP_ICON_NAME:
- ide_page_set_icon_name (self, g_value_get_string (value));
- break;
-
- case PROP_ICON:
- ide_page_set_icon (self, g_value_get_object (value));
- break;
-
case PROP_MENU_ID:
ide_page_set_menu_id (self, g_value_get_string (value));
break;
- case PROP_MODIFIED:
- ide_page_set_modified (self, g_value_get_boolean (value));
- break;
-
- case PROP_TITLE:
- ide_page_set_title (self, g_value_get_string (value));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -277,20 +238,6 @@ ide_page_class_init (IdePageClass *klass)
FALSE,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
- properties [PROP_ICON] =
- g_param_spec_object ("icon",
- "Icon",
- "A GIcon for the view",
- G_TYPE_ICON,
- (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
-
- properties [PROP_ICON_NAME] =
- g_param_spec_string ("icon-name",
- "Icon Name",
- "The icon-name describing the view content",
- "text-x-generic-symbolic",
- (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
-
properties [PROP_MENU_ID] =
g_param_spec_string ("menu-id",
"Menu ID",
@@ -298,20 +245,6 @@ ide_page_class_init (IdePageClass *klass)
NULL,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
- properties [PROP_MODIFIED] =
- g_param_spec_boolean ("modified",
- "Modified",
- "If the view has been modified from the saved content",
- FALSE,
- (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
-
- properties [PROP_TITLE] =
- g_param_spec_string ("title",
- "Title",
- "The title of the document or view",
- NULL,
- (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
-
g_object_class_install_properties (object_class, N_PROPS, properties);
/**
@@ -356,38 +289,6 @@ ide_page_init (IdePage *self)
gtk_widget_insert_action_group (GTK_WIDGET (self), "view", G_ACTION_GROUP (group));
}
-GtkWidget *
-ide_page_new (void)
-{
- return g_object_new (IDE_TYPE_PAGE, NULL);
-}
-
-const char *
-ide_page_get_title (IdePage *self)
-{
- IdePagePrivate *priv = ide_page_get_instance_private (self);
-
- g_return_val_if_fail (IDE_IS_PAGE (self), NULL);
-
- return priv->title;
-}
-
-void
-ide_page_set_title (IdePage *self,
- const char *title)
-{
- IdePagePrivate *priv = ide_page_get_instance_private (self);
-
- g_return_if_fail (IDE_IS_PAGE (self));
-
- if (g_strcmp0 (title, priv->title) != 0)
- {
- g_free (priv->title);
- priv->title = g_strdup (title);
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]);
- }
-}
-
const char *
ide_page_get_menu_id (IdePage *self)
{
@@ -465,97 +366,6 @@ ide_page_set_failed (IdePage *self,
}
}
-gboolean
-ide_page_get_modified (IdePage *self)
-{
- IdePagePrivate *priv = ide_page_get_instance_private (self);
-
- g_return_val_if_fail (IDE_IS_PAGE (self), FALSE);
-
- return priv->modified;
-}
-
-void
-ide_page_set_modified (IdePage *self,
- gboolean modified)
-{
- IdePagePrivate *priv = ide_page_get_instance_private (self);
-
- g_return_if_fail (IDE_IS_PAGE (self));
-
- modified = !!modified;
-
- if (priv->modified != modified)
- {
- priv->modified = modified;
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_MODIFIED]);
- }
-}
-
-/**
- * ide_page_get_icon:
- * @self: a #IdePage
- *
- * Gets the #GIcon to represent the view.
- *
- * Returns: (transfer none) (nullable): A #GIcon or %NULL
- */
-GIcon *
-ide_page_get_icon (IdePage *self)
-{
- IdePagePrivate *priv = ide_page_get_instance_private (self);
-
- g_return_val_if_fail (IDE_IS_PAGE (self), NULL);
-
- if (priv->icon == NULL)
- {
- if (priv->icon_name != NULL)
- priv->icon = g_icon_new_for_string (priv->icon_name, NULL);
- }
-
- return priv->icon;
-}
-
-void
-ide_page_set_icon (IdePage *self,
- GIcon *icon)
-{
- IdePagePrivate *priv = ide_page_get_instance_private (self);
-
- g_return_if_fail (IDE_IS_PAGE (self));
-
- if (g_set_object (&priv->icon, icon))
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ICON]);
-}
-
-const char *
-ide_page_get_icon_name (IdePage *self)
-{
- IdePagePrivate *priv = ide_page_get_instance_private (self);
-
- g_return_val_if_fail (IDE_IS_PAGE (self), NULL);
-
- return priv->icon_name;
-}
-
-void
-ide_page_set_icon_name (IdePage *self,
- const char *icon_name)
-{
- IdePagePrivate *priv = ide_page_get_instance_private (self);
-
- g_return_if_fail (IDE_IS_PAGE (self));
-
- icon_name = g_intern_string (icon_name);
-
- if (icon_name != priv->icon_name)
- {
- priv->icon_name = icon_name;
- g_clear_object (&priv->icon);
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ICON_NAME]);
- }
-}
-
gboolean
ide_page_get_can_split (IdePage *self)
{
diff --git a/src/libide/gui/ide-page.h b/src/libide/gui/ide-page.h
index 7a0cd76f3..8bdafe0e6 100644
--- a/src/libide/gui/ide-page.h
+++ b/src/libide/gui/ide-page.h
@@ -56,8 +56,6 @@ struct _IdePageClass
gpointer _reserved[8];
};
-IDE_AVAILABLE_IN_ALL
-GtkWidget *ide_page_new (void);
IDE_AVAILABLE_IN_ALL
gboolean ide_page_get_can_split (IdePage *self);
IDE_AVAILABLE_IN_ALL
@@ -66,16 +64,6 @@ void ide_page_set_can_split (IdePage *self,
IDE_AVAILABLE_IN_ALL
IdePage *ide_page_create_split (IdePage *self);
IDE_AVAILABLE_IN_ALL
-const gchar *ide_page_get_icon_name (IdePage *self);
-IDE_AVAILABLE_IN_ALL
-void ide_page_set_icon_name (IdePage *self,
- const gchar *icon_name);
-IDE_AVAILABLE_IN_ALL
-GIcon *ide_page_get_icon (IdePage *self);
-IDE_AVAILABLE_IN_ALL
-void ide_page_set_icon (IdePage *self,
- GIcon *icon);
-IDE_AVAILABLE_IN_ALL
gboolean ide_page_get_failed (IdePage *self);
IDE_AVAILABLE_IN_ALL
void ide_page_set_failed (IdePage *self,
@@ -86,16 +74,6 @@ IDE_AVAILABLE_IN_ALL
void ide_page_set_menu_id (IdePage *self,
const gchar *menu_id);
IDE_AVAILABLE_IN_ALL
-gboolean ide_page_get_modified (IdePage *self);
-IDE_AVAILABLE_IN_ALL
-void ide_page_set_modified (IdePage *self,
- gboolean modified);
-IDE_AVAILABLE_IN_ALL
-const gchar *ide_page_get_title (IdePage *self);
-IDE_AVAILABLE_IN_ALL
-void ide_page_set_title (IdePage *self,
- const gchar *title);
-IDE_AVAILABLE_IN_ALL
void ide_page_agree_to_close_async (IdePage *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]