[gnome-photos/wip/rishi/edit-mode: 19/25] Add PhotosToolFilters



commit da226434592c5746569379e730c5f06955a3c3be
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jun 2 23:18:53 2015 +0200

    Add PhotosToolFilters

 po/POTFILES.in            |    1 +
 src/Makefile.am           |    2 +
 src/photos-icons.h        |    1 +
 src/photos-tool-filters.c |  141 +++++++++++++++++++++++++++++++++++++++++++++
 src/photos-tool-filters.h |   45 ++++++++++++++
 src/photos-utils.c        |    2 +
 6 files changed, 192 insertions(+), 0 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9ea50f8..a093460 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -35,5 +35,6 @@ src/photos-search-type-manager.c
 src/photos-selection-toolbar.c
 src/photos-source-manager.c
 src/photos-spinner-box.c
+src/photos-tool-filter.c
 src/photos-tool-sharpen.c
 src/photos-tracker-controller.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 91788fd..310a981 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -218,6 +218,8 @@ gnome_photos_SOURCES = \
        photos-spinner-box.h \
        photos-tool.c \
        photos-tool.h \
+       photos-tool-filters.c \
+       photos-tool-filters.h \
        photos-tool-sharpen.c \
        photos-tool-sharpen.h \
        photos-tracker-change-event.c \
diff --git a/src/photos-icons.h b/src/photos-icons.h
index 9ce2226..80864ed 100644
--- a/src/photos-icons.h
+++ b/src/photos-icons.h
@@ -40,6 +40,7 @@ G_BEGIN_DECLS
 #define PHOTOS_ICON_GO_NEXT_SYMBOLIC "go-next-symbolic"
 #define PHOTOS_ICON_GO_PREVIOUS_SYMBOLIC "go-previous-symbolic"
 
+#define PHOTOS_ICON_IMAGE_FILTER_SYMBOLIC "image-filter-symbolic"
 #define PHOTOS_ICON_IMAGE_SHARPEN_SYMBOLIC "image-sharpen-symbolic"
 
 #define PHOTOS_ICON_IMAGE_X_GENERIC_SYMBOLIC "image-x-generic-symbolic"
diff --git a/src/photos-tool-filters.c b/src/photos-tool-filters.c
new file mode 100644
index 0000000..93eae9a
--- /dev/null
+++ b/src/photos-tool-filters.c
@@ -0,0 +1,141 @@
+/*
+ * 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/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "photos-icons.h"
+#include "photos-operation-insta-common.h"
+#include "photos-tool.h"
+#include "photos-tool-filters.h"
+#include "photos-utils.h"
+
+
+struct _PhotosToolFilters
+{
+  PhotosTool parent_instance;
+  GtkWidget *grid;
+};
+
+struct _PhotosToolFiltersClass
+{
+  PhotosToolClass parent_class;
+};
+
+
+G_DEFINE_TYPE_WITH_CODE (PhotosToolFilters, photos_tool_filters, PHOTOS_TYPE_TOOL,
+                         photos_utils_ensure_extension_points ();
+                         g_io_extension_point_implement (PHOTOS_TOOL_EXTENSION_POINT_NAME,
+                                                         g_define_type_id,
+                                                         "filters",
+                                                         500));
+
+
+static void
+photos_tool_filters_activate (PhotosTool *tool, PhotosBaseItem *item, GeglGtkView *view)
+{
+}
+
+
+static GtkWidget *
+photos_tool_filters_get_widget (PhotosTool *tool)
+{
+  PhotosToolFilters *self = PHOTOS_TOOL_FILTERS (tool);
+  return self->grid;
+}
+
+
+static void
+photos_tool_filters_dispose (GObject *object)
+{
+  PhotosToolFilters *self = PHOTOS_TOOL_FILTERS (object);
+
+  g_clear_object (&self->grid);
+
+  G_OBJECT_CLASS (photos_tool_filters_parent_class)->dispose (object);
+}
+
+
+static void
+photos_tool_filters_init (PhotosToolFilters *self)
+{
+  GtkWidget *button;
+  guint row = 0;
+
+  self->grid = g_object_ref_sink (gtk_grid_new ());
+
+  button = gtk_button_new_with_label (_("None"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.insta-current");
+  gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "n", (gint16) 
PHOTOS_OPERATION_INSTA_PRESET_NONE);
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_grid_attach (GTK_GRID (self->grid), button, 0, row, 1, 1);
+
+  button = gtk_button_new_with_label (_("1977"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.insta-current");
+  gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "n", (gint16) 
PHOTOS_OPERATION_INSTA_PRESET_1977);
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_grid_attach (GTK_GRID (self->grid), button, 1, row, 1, 1);
+  row++;
+
+  button = gtk_button_new_with_label (_("Brannan"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.insta-current");
+  gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "n", (gint16) 
PHOTOS_OPERATION_INSTA_PRESET_BRANNAN);
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_grid_attach (GTK_GRID (self->grid), button, 0, row, 1, 1);
+
+  button = gtk_button_new_with_label (_("Gotham"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.insta-current");
+  gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "n", (gint16) 
PHOTOS_OPERATION_INSTA_PRESET_GOTHAM);
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_grid_attach (GTK_GRID (self->grid), button, 1, row, 1, 1);
+  row++;
+
+  button = gtk_button_new_with_label (_("Gray"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.insta-current");
+  gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "n", (gint16) 
PHOTOS_OPERATION_INSTA_PRESET_GRAY);
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_grid_attach (GTK_GRID (self->grid), button, 0, row, 1, 1);
+
+  button = gtk_button_new_with_label (_("Nashville"));
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.insta-current");
+  gtk_actionable_set_action_target (GTK_ACTIONABLE (button), "n", (gint16) 
PHOTOS_OPERATION_INSTA_PRESET_NASHVILLE);
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_grid_attach (GTK_GRID (self->grid), button, 1, row, 1, 1);
+  row++;
+}
+
+
+static void
+photos_tool_filters_class_init (PhotosToolFiltersClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+  PhotosToolClass *tool_class = PHOTOS_TOOL_CLASS (class);
+
+  tool_class->icon_name = PHOTOS_ICON_IMAGE_FILTER_SYMBOLIC;
+  tool_class->name = _("Filters");
+
+  object_class->dispose = photos_tool_filters_dispose;
+  tool_class->activate = photos_tool_filters_activate;
+  tool_class->get_widget = photos_tool_filters_get_widget;
+}
diff --git a/src/photos-tool-filters.h b/src/photos-tool-filters.h
new file mode 100644
index 0000000..504cc37
--- /dev/null
+++ b/src/photos-tool-filters.h
@@ -0,0 +1,45 @@
+/*
+ * 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_FILTERS_H
+#define PHOTOS_TOOL_FILTERS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_TOOL_FILTERS (photos_tool_filters_get_type ())
+
+#define PHOTOS_TOOL_FILTERS(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+   PHOTOS_TYPE_TOOL_FILTERS, PhotosToolFilters))
+
+#define PHOTOS_IS_TOOL_FILTERS(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+   PHOTOS_TYPE_TOOL_FILTERS))
+
+typedef struct _PhotosToolFilters      PhotosToolFilters;
+typedef struct _PhotosToolFiltersClass PhotosToolFiltersClass;
+
+GType               photos_tool_filters_get_type           (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* PHOTOS_TOOL_FILTERS_H */
diff --git a/src/photos-utils.c b/src/photos-utils.c
index 8c37ba7..80aab65 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -46,6 +46,7 @@
 #include "photos-query.h"
 #include "photos-source.h"
 #include "photos-tool.h"
+#include "photos-tool-filters.h"
 #include "photos-tool-sharpen.h"
 #include "photos-tracker-queue.h"
 #include "photos-utils.h"
@@ -537,6 +538,7 @@ photos_utils_ensure_builtins (void)
       g_type_ensure (PHOTOS_TYPE_OPERATION_INSTA_CURVE);
       g_type_ensure (PHOTOS_TYPE_OPERATION_INSTA_FILTER);
 
+      g_type_ensure (PHOTOS_TYPE_TOOL_FILTERS);
       g_type_ensure (PHOTOS_TYPE_TOOL_SHARPEN);
 
       g_once_init_leave (&once_init_value, 1);


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