[gnome-flashback] desktop: add GfIconView
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] desktop: add GfIconView
- Date: Sat, 26 Oct 2019 09:53:26 +0000 (UTC)
commit db4b2f97702369f84b244760e60fe7188b32b3cb
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Oct 26 12:52:50 2019 +0300
desktop: add GfIconView
gnome-flashback/libdesktop/Makefile.am | 2 ++
gnome-flashback/libdesktop/gf-desktop-window.c | 23 ++++++++++++--
gnome-flashback/libdesktop/gf-icon-view.c | 42 ++++++++++++++++++++++++++
gnome-flashback/libdesktop/gf-icon-view.h | 32 ++++++++++++++++++++
4 files changed, 96 insertions(+), 3 deletions(-)
---
diff --git a/gnome-flashback/libdesktop/Makefile.am b/gnome-flashback/libdesktop/Makefile.am
index 7171692..a8110f8 100644
--- a/gnome-flashback/libdesktop/Makefile.am
+++ b/gnome-flashback/libdesktop/Makefile.am
@@ -19,6 +19,8 @@ libdesktop_la_SOURCES = \
gf-desktop-window.h \
gf-desktop.c \
gf-desktop.h \
+ gf-icon-view.c \
+ gf-icon-view.h \
$(NULL)
libdesktop_la_LDFLAGS = \
diff --git a/gnome-flashback/libdesktop/gf-desktop-window.c b/gnome-flashback/libdesktop/gf-desktop-window.c
index 70b5f26..380818f 100644
--- a/gnome-flashback/libdesktop/gf-desktop-window.c
+++ b/gnome-flashback/libdesktop/gf-desktop-window.c
@@ -18,12 +18,16 @@
#include "config.h"
#include "gf-desktop-window.h"
+#include "gf-icon-view.h"
+
struct _GfDesktopWindow
{
- GtkWindow parent;
+ GtkWindow parent;
+
+ gboolean draw_background;
- gboolean draw_background;
- gboolean show_icons;
+ gboolean show_icons;
+ GtkWidget *icon_view;
};
enum
@@ -48,6 +52,19 @@ draw_background_changed (GfDesktopWindow *self)
static void
show_icons_changed (GfDesktopWindow *self)
{
+ if (self->show_icons)
+ {
+ g_assert (self->icon_view == NULL);
+ self->icon_view = gf_icon_view_new ();
+
+ gtk_container_add (GTK_CONTAINER (self), self->icon_view);
+ gtk_widget_show (self->icon_view);
+ }
+ else if (self->icon_view != NULL)
+ {
+ gtk_container_remove (GTK_CONTAINER (self), self->icon_view);
+ self->icon_view = NULL;
+ }
}
static void
diff --git a/gnome-flashback/libdesktop/gf-icon-view.c b/gnome-flashback/libdesktop/gf-icon-view.c
new file mode 100644
index 0000000..802356e
--- /dev/null
+++ b/gnome-flashback/libdesktop/gf-icon-view.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2019 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include "gf-icon-view.h"
+
+struct _GfIconView
+{
+ GtkFixed parent;
+};
+
+G_DEFINE_TYPE (GfIconView, gf_icon_view, GTK_TYPE_FIXED)
+
+static void
+gf_icon_view_class_init (GfIconViewClass *self_class)
+{
+}
+
+static void
+gf_icon_view_init (GfIconView *self)
+{
+}
+
+GtkWidget *
+gf_icon_view_new (void)
+{
+ return g_object_new (GF_TYPE_ICON_VIEW, NULL);
+}
diff --git a/gnome-flashback/libdesktop/gf-icon-view.h b/gnome-flashback/libdesktop/gf-icon-view.h
new file mode 100644
index 0000000..966ab74
--- /dev/null
+++ b/gnome-flashback/libdesktop/gf-icon-view.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2019 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GF_ICON_VIEW_H
+#define GF_ICON_VIEW_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GF_TYPE_ICON_VIEW (gf_icon_view_get_type ())
+G_DECLARE_FINAL_TYPE (GfIconView, gf_icon_view, GF, ICON_VIEW, GtkFixed)
+
+GtkWidget *gf_icon_view_new (void);
+
+G_END_DECLS
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]