[gnome-flashback] desktop: add GfDummyIcon
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] desktop: add GfDummyIcon
- Date: Wed, 13 Nov 2019 22:33:00 +0000 (UTC)
commit fa00f1a83f3551948daf1d3b365f4c1076b9a4c8
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Wed Nov 13 17:04:24 2019 +0200
desktop: add GfDummyIcon
gnome-flashback/libdesktop/Makefile.am | 2 +
gnome-flashback/libdesktop/gf-dummy-icon.c | 70 ++++++++++++++++++++++++++++
gnome-flashback/libdesktop/gf-dummy-icon.h | 32 +++++++++++++
gnome-flashback/libdesktop/gf-monitor-view.c | 24 +---------
4 files changed, 106 insertions(+), 22 deletions(-)
---
diff --git a/gnome-flashback/libdesktop/Makefile.am b/gnome-flashback/libdesktop/Makefile.am
index 744244f..e48461e 100644
--- a/gnome-flashback/libdesktop/Makefile.am
+++ b/gnome-flashback/libdesktop/Makefile.am
@@ -25,6 +25,8 @@ libdesktop_la_SOURCES = \
gf-desktop-window.h \
gf-desktop.c \
gf-desktop.h \
+ gf-dummy-icon.c \
+ gf-dummy-icon.h \
gf-icon-view.c \
gf-icon-view.h \
gf-icon.c \
diff --git a/gnome-flashback/libdesktop/gf-dummy-icon.c b/gnome-flashback/libdesktop/gf-dummy-icon.c
new file mode 100644
index 0000000..2a69d4c
--- /dev/null
+++ b/gnome-flashback/libdesktop/gf-dummy-icon.c
@@ -0,0 +1,70 @@
+/*
+ * 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-dummy-icon.h"
+
+struct _GfDummyIcon
+{
+ GfIcon parent;
+};
+
+G_DEFINE_TYPE (GfDummyIcon, gf_dummy_icon, GF_TYPE_ICON)
+
+static void
+gf_dummy_icon_class_init (GfDummyIconClass *self_class)
+{
+}
+
+static void
+gf_dummy_icon_init (GfDummyIcon *self)
+{
+}
+
+GtkWidget *
+gf_dummy_icon_new (void)
+{
+ GFile *file;
+ GFileInfo *info;
+ GIcon *icon;
+ const char *name;
+ GtkWidget *widget;
+
+ file = g_file_new_for_commandline_arg ("");
+ info = g_file_info_new ();
+
+ icon = g_icon_new_for_string ("text-x-generic", NULL);
+ g_file_info_set_icon (info, icon);
+ g_object_unref (icon);
+
+ name = "Lorem Ipsum is simply dummy text of the printing and typesetting "
+ "industry. Lorem Ipsum has been the industry's standard dummy text "
+ "ever since the 1500s, when an unknown printer took a galley of "
+ "type and scrambled it to make a type specimen book.";
+
+ g_file_info_set_display_name (info, name);
+
+ widget = g_object_new (GF_TYPE_DUMMY_ICON,
+ "file", file,
+ "info", info,
+ NULL);
+
+ g_object_unref (file);
+ g_object_unref (info);
+
+ return widget;
+}
diff --git a/gnome-flashback/libdesktop/gf-dummy-icon.h b/gnome-flashback/libdesktop/gf-dummy-icon.h
new file mode 100644
index 0000000..e774410
--- /dev/null
+++ b/gnome-flashback/libdesktop/gf-dummy-icon.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_DUMMY_ICON_H
+#define GF_DUMMY_ICON_H
+
+#include "gf-icon.h"
+
+G_BEGIN_DECLS
+
+#define GF_TYPE_DUMMY_ICON (gf_dummy_icon_get_type ())
+G_DECLARE_FINAL_TYPE (GfDummyIcon, gf_dummy_icon, GF, DUMMY_ICON, GfIcon)
+
+GtkWidget *gf_dummy_icon_new (void);
+
+G_END_DECLS
+
+#endif
diff --git a/gnome-flashback/libdesktop/gf-monitor-view.c b/gnome-flashback/libdesktop/gf-monitor-view.c
index da28bf6..c07ed91 100644
--- a/gnome-flashback/libdesktop/gf-monitor-view.c
+++ b/gnome-flashback/libdesktop/gf-monitor-view.c
@@ -19,6 +19,7 @@
#include "gf-monitor-view.h"
#include "gf-desktop-enum-types.h"
+#include "gf-dummy-icon.h"
#include "gf-icon.h"
struct _GfMonitorView
@@ -122,30 +123,9 @@ icon_style_updated_cb (GtkWidget *widget,
static GtkWidget *
create_dummy_icon (GfMonitorView *self)
{
- GFile *file;
- GFileInfo *info;
- GIcon *icon;
- const char *name;
GtkWidget *widget;
- file = g_file_new_for_commandline_arg ("");
- info = g_file_info_new ();
-
- icon = g_icon_new_for_string ("text-x-generic", NULL);
- g_file_info_set_icon (info, icon);
- g_object_unref (icon);
-
- name = "Lorem Ipsum is simply dummy text of the printing and typesetting "
- "industry. Lorem Ipsum has been the industry's standard dummy text "
- "ever since the 1500s, when an unknown printer took a galley of "
- "type and scrambled it to make a type specimen book.";
-
- g_file_info_set_display_name (info, name);
-
- widget = gf_icon_new (file, info);
-
- g_object_unref (file);
- g_object_unref (info);
+ widget = gf_dummy_icon_new ();
g_object_ref_sink (widget);
gtk_widget_set_parent (widget, GTK_WIDGET (self));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]