[gnome-photos/wip/rishi/edit-mode: 21/28] Add PhotosToolFilters



commit b405e00fc2642a669d75970356987d0c316d5003
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 5f28f14..9b33725 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -32,4 +32,5 @@ src/photos-selection-toolbar.c
 src/photos-source-manager.c
 src/photos-spinner-box.c
 src/photos-tool-enhance.c
+src/photos-tool-filters.c
 src/photos-tracker-controller.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c40c12..225f87f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -192,6 +192,8 @@ gnome_photos_SOURCES = \
        photos-tool.h \
        photos-tool-enhance.c \
        photos-tool-enhance.h \
+       photos-tool-filters.c \
+       photos-tool-filters.h \
        photos-tracker-change-event.c \
        photos-tracker-change-event.h \
        photos-tracker-change-monitor.c \
diff --git a/src/photos-icons.h b/src/photos-icons.h
index f7fcc2f..5dc471a 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 b435073..57689fd 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -47,6 +47,7 @@
 #include "photos-source.h"
 #include "photos-tool.h"
 #include "photos-tool-enhance.h"
+#include "photos-tool-filters.h"
 #include "photos-tracker-collections-controller.h"
 #include "photos-tracker-controller.h"
 #include "photos-tracker-favorites-controller.h"
@@ -526,6 +527,7 @@ photos_utils_ensure_builtins (void)
       g_type_ensure (PHOTOS_TYPE_OPERATION_INSTA_FILTER);
 
       g_type_ensure (PHOTOS_TYPE_TOOL_ENHANCE);
+      g_type_ensure (PHOTOS_TYPE_TOOL_FILTERS);
 
       g_type_ensure (PHOTOS_TYPE_TRACKER_COLLECTIONS_CONTROLLER);
       g_type_ensure (PHOTOS_TYPE_TRACKER_FAVORITES_CONTROLLER);


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