[gnome-photos/wip/rishi/edit-mode: 16/22] Add PhotosTool



commit f112a978baf94fe078f35a67b3dbb51ce1921f8f
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jun 2 20:35:39 2015 +0200

    Add PhotosTool

 src/Makefile.am   |    2 +
 src/photos-tool.c |  131 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/photos-tool.h |   88 +++++++++++++++++++++++++++++++++++
 3 files changed, 221 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index b1c0c2f..5ca0a43 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -216,6 +216,8 @@ gnome_photos_SOURCES = \
        photos-source-manager.h \
        photos-spinner-box.c \
        photos-spinner-box.h \
+       photos-tool.c \
+       photos-tool.h \
        photos-tracker-change-event.c \
        photos-tracker-change-event.h \
        photos-tracker-change-monitor.c \
diff --git a/src/photos-tool.c b/src/photos-tool.c
new file mode 100644
index 0000000..9123d1a
--- /dev/null
+++ b/src/photos-tool.c
@@ -0,0 +1,131 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2015 Red Hat, Inc.
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#include "config.h"
+
+#include <gio/gio.h>
+#include <glib.h>
+
+#include "photos-tool.h"
+#include "photos-utils.h"
+
+
+struct _PhotosToolPrivate
+{
+  gint dummy;
+};
+
+enum
+{
+  PROP_0
+};
+
+enum
+{
+  LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (PhotosTool, photos_tool, G_TYPE_OBJECT);
+
+
+static void
+photos_tool_default_draw (PhotosTool *self, cairo_t *cr)
+{
+}
+
+
+static void
+photos_tool_constructed (GObject *object)
+{
+  PhotosTool *self = PHOTOS_TOOL (object);
+  PhotosToolPrivate *priv = self->priv;
+
+  G_OBJECT_CLASS (photos_tool_parent_class)->constructed (object);
+}
+
+
+static void
+photos_tool_dispose (GObject *object)
+{
+  PhotosTool *self = PHOTOS_TOOL (object);
+  PhotosToolPrivate *priv = self->priv;
+
+  G_OBJECT_CLASS (photos_tool_parent_class)->dispose (object);
+}
+
+
+static void
+photos_tool_finalize (GObject *object)
+{
+  PhotosTool *self = PHOTOS_TOOL (object);
+  PhotosToolPrivate *priv = self->priv;
+
+  G_OBJECT_CLASS (photos_tool_parent_class)->finalize (object);
+}
+
+
+static void
+photos_tool_init (PhotosTool *self)
+{
+  self->priv = photos_tool_get_instance_private (self);
+}
+
+
+static void
+photos_tool_class_init (PhotosToolClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+  object_class->dispose = photos_tool_dispose;
+  object_class->finalize = photos_tool_finalize;
+  class->draw = photos_tool_default_draw;
+}
+
+
+void
+photos_tool_draw (PhotosTool *self, cairo_t *cr)
+{
+  return PHOTOS_TOOL_GET_CLASS (self)->draw (self, cr);
+}
+
+
+const gchar *
+photos_tool_get_icon_name (PhotosTool *self)
+{
+  return PHOTOS_TOOL_GET_CLASS (self)->get_icon_name (self);
+}
+
+
+const gchar *
+photos_tool_get_name (PhotosTool *self)
+{
+  return PHOTOS_TOOL_GET_CLASS (self)->get_name (self);
+}
+
+
+GtkWidget *
+photos_tool_get_widget (PhotosTool *self)
+{
+  return PHOTOS_TOOL_GET_CLASS (self)->get_widget (self);
+}
diff --git a/src/photos-tool.h b/src/photos-tool.h
new file mode 100644
index 0000000..b542335
--- /dev/null
+++ b/src/photos-tool.h
@@ -0,0 +1,88 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2015 Red Hat, Inc.
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef PHOTOS_TOOL_H
+#define PHOTOS_TOOL_H
+
+#include <cairo.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_TOOL (photos_tool_get_type ())
+
+#define PHOTOS_TOOL(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+   PHOTOS_TYPE_TOOL, PhotosTool))
+
+#define PHOTOS_TOOL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+   PHOTOS_TYPE_TOOL, PhotosToolClass))
+
+#define PHOTOS_IS_TOOL(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+   PHOTOS_TYPE_TOOL))
+
+#define PHOTOS_IS_TOOL_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+   PHOTOS_TYPE_TOOL))
+
+#define PHOTOS_TOOL_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+   PHOTOS_TYPE_TOOL, PhotosToolClass))
+
+typedef struct _PhotosTool        PhotosTool;
+typedef struct _PhotosToolClass   PhotosToolClass;
+typedef struct _PhotosToolPrivate PhotosToolPrivate;
+
+struct _PhotosTool
+{
+  GObject parent_instance;
+  PhotosToolPrivate *priv;
+};
+
+struct _PhotosToolClass
+{
+  GObjectClass parent_class;
+
+  /* virtual methods */
+  void          (*draw)                       (PhotosTool *self, cairo_t *cr);
+  const gchar  *(*get_icon_name)              (PhotosTool *self);
+  const gchar  *(*get_name)                   (PhotosTool *self);
+  GtkWidget    *(*get_widget)                 (PhotosTool *self);
+
+  /* signals */
+  void        (*info_updated)               (PhotosTool *self);
+};
+
+GType               photos_tool_get_type                (void) G_GNUC_CONST;
+
+void                photos_tool_draw                    (PhotosTool *self, cairo_t *cr);
+
+const gchar        *photos_tool_get_icon_name           (PhotosTool *self);
+
+const gchar        *photos_tool_get_name                (PhotosTool *self);
+
+GtkWidget          *photos_tool_get_widget              (PhotosTool *self);
+
+G_END_DECLS
+
+#endif /* PHOTOS_TOOL_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]