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



commit 827946ca61bc29b325cdd8c248be561c0935931f
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 |  115 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/photos-tool.h |  100 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 217 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..7b9917b
--- /dev/null
+++ b/src/photos-tool.c
@@ -0,0 +1,115 @@
+/*
+ * 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"
+
+
+G_DEFINE_ABSTRACT_TYPE (PhotosTool, photos_tool, G_TYPE_OBJECT);
+
+
+static void
+photos_tool_default_draw (PhotosTool *self, cairo_t *cr, GdkRectangle *rect)
+{
+}
+
+
+static gboolean
+photos_tool_default_left_click_event (PhotosTool *self, GdkEventButton *event)
+{
+  return GDK_EVENT_PROPAGATE;
+}
+
+
+static gboolean
+photos_tool_default_left_unclick_event (PhotosTool *self, GdkEventButton *event)
+{
+  return GDK_EVENT_PROPAGATE;
+}
+
+
+static void
+photos_tool_init (PhotosTool *self)
+{
+}
+
+
+static void
+photos_tool_class_init (PhotosToolClass *class)
+{
+  class->draw = photos_tool_default_draw;
+  class->left_click_event = photos_tool_default_left_click_event;
+  class->left_unclick_event = photos_tool_default_left_unclick_event;
+}
+
+
+void
+photos_tool_activate (PhotosTool *self, PhotosBaseItem *item, GeglGtkView *view)
+{
+  PHOTOS_TOOL_GET_CLASS (self)->activate (self, item, view);
+}
+
+
+void
+photos_tool_draw (PhotosTool *self, cairo_t *cr, GdkRectangle *rect)
+{
+  return PHOTOS_TOOL_GET_CLASS (self)->draw (self, cr, rect);
+}
+
+
+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);
+}
+
+
+gboolean
+photos_tool_left_click_event (PhotosTool *self, GdkEventButton *event)
+{
+  return PHOTOS_TOOL_GET_CLASS (self)->left_click_event (self, event);
+}
+
+
+gboolean
+photos_tool_left_unclick_event (PhotosTool *self, GdkEventButton *event)
+{
+  return PHOTOS_TOOL_GET_CLASS (self)->left_unclick_event (self, event);
+}
diff --git a/src/photos-tool.h b/src/photos-tool.h
new file mode 100644
index 0000000..81ae39d
--- /dev/null
+++ b/src/photos-tool.h
@@ -0,0 +1,100 @@
+/*
+ * 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 <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+#include "gegl-gtk-view.h"
+#include "photos-base-item.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          (*activate)                   (PhotosTool *self, PhotosBaseItem *item, GeglGtkView *view);
+  void          (*draw)                       (PhotosTool *self, cairo_t *cr, GdkRectangle *rect);
+  const gchar  *(*get_icon_name)              (PhotosTool *self);
+  const gchar  *(*get_name)                   (PhotosTool *self);
+  GtkWidget    *(*get_widget)                 (PhotosTool *self);
+  gboolean      (*left_click_event)           (PhotosTool *self, GdkEventButton *event);
+  gboolean      (*left_unclick_event)         (PhotosTool *self, GdkEventButton *event);
+
+  /* signals */
+  void        (*info_updated)               (PhotosTool *self);
+};
+
+GType               photos_tool_get_type                (void) G_GNUC_CONST;
+
+void                photos_tool_activate                (PhotosTool *self, PhotosBaseItem *item, GeglGtkView 
*view);
+
+void                photos_tool_draw                    (PhotosTool *self, cairo_t *cr, GdkRectangle *rect);
+
+const gchar        *photos_tool_get_icon_name           (PhotosTool *self);
+
+const gchar        *photos_tool_get_name                (PhotosTool *self);
+
+GtkWidget          *photos_tool_get_widget              (PhotosTool *self);
+
+gboolean            photos_tool_left_click_event        (PhotosTool *self, GdkEventButton *event);
+
+gboolean            photos_tool_left_unclick_event      (PhotosTool *self, GdkEventButton *event);
+
+G_END_DECLS
+
+#endif /* PHOTOS_TOOL_H */


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