[gnome-notes] Remove note icon support
- From: Isaque Galdino de Araujo <igaldino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-notes] Remove note icon support
- Date: Tue, 11 May 2021 23:24:41 +0000 (UTC)
commit 15f0f0da99ee81f0db5feeebdb898ee9f997095b
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date: Sun Apr 18 15:05:56 2021 +0530
Remove note icon support
We no longer have Grid View, and thus we don't use icons
anywhere except search, which is removed in this commit
as those small icons are never readable.
Also, remove all code thus no longer used
src/bijiben-shell-search-provider.c | 48 -------------------------------------
src/libbiji/biji-note-obj.c | 39 +-----------------------------
src/libbiji/biji-note-obj.h | 5 ----
3 files changed, 1 insertion(+), 91 deletions(-)
---
diff --git a/src/bijiben-shell-search-provider.c b/src/bijiben-shell-search-provider.c
index 35417ee..02b6a86 100644
--- a/src/bijiben-shell-search-provider.c
+++ b/src/bijiben-shell-search-provider.c
@@ -198,46 +198,6 @@ handle_get_subsearch_result_set (BijibenShellSearchProvider2 *skeleton,
g_application_release (user_data);
}
-static GVariant *
-get_note_icon (BijibenShellSearchProviderApp *self,
- const gchar *note__nie_url)
-{
- GVariant *variant;
- GIcon *gicon;
- gint scale_factor;
- BijiItem *item;
-
- scale_factor = gdk_monitor_get_scale_factor (gdk_display_get_primary_monitor (gdk_display_get_default ()));
-
- gicon = NULL;
- item = biji_manager_get_item_at_path (self->manager, note__nie_url);
- if (item != NULL && BIJI_IS_ITEM(item))
- {
- /* Load the icon from the note */
- cairo_surface_t *surface = biji_item_get_icon (item, scale_factor);
- gicon = G_ICON (gdk_pixbuf_get_from_surface (surface, 0, 0,
- cairo_image_surface_get_width (surface),
- cairo_image_surface_get_height (surface)));
- }
-
- if (gicon == NULL)
- {
- /* Fallback to generic icon */
- char *path = g_build_filename (DATADIR, "bijiben", "icons", "hicolor",
- "48x48", "actions", "note.png", NULL);
- GFile *file = g_file_new_for_path (path);
- gicon = g_file_icon_new (file);
-
- g_free (path);
- g_object_unref (file);
- }
-
- variant = g_icon_serialize (gicon);
- g_object_unref (gicon);
-
- return variant;
-}
-
static void
add_single_note_meta (BijibenShellSearchProviderApp *self,
gchar *note__id,
@@ -247,7 +207,6 @@ add_single_note_meta (BijibenShellSearchProviderApp *self,
const gchar *url;
const gchar *result;
TrackerSparqlCursor *cursor;
- GVariant *icon;
query = g_strdup_printf ("SELECT nie:url(<%s>) nie:title(<%s>) WHERE { }",
note__id, note__id);
@@ -269,13 +228,6 @@ add_single_note_meta (BijibenShellSearchProviderApp *self,
if (result == NULL || result[0] == '\0')
result = _("Untitled");
g_variant_builder_add (results, "{sv}", "name", g_variant_new_string (result));
-
- /* ICON is currently generic icon, *
- * TODO serialize icons in libbiji *
- * or deserialize note here ) */
- icon = get_note_icon (self, url);
- g_variant_builder_add (results, "{sv}", "icon", icon);
-
g_variant_builder_close (results);
}
diff --git a/src/libbiji/biji-note-obj.c b/src/libbiji/biji-note-obj.c
index ccbd3d3..c2a3e5e 100644
--- a/src/libbiji/biji-note-obj.c
+++ b/src/libbiji/biji-note-obj.c
@@ -235,28 +235,11 @@ trash (BijiItem *item)
{
BijiNoteObj *self = BIJI_NOTE_OBJ (item);
BijiNoteObjPrivate *priv = biji_note_obj_get_instance_private (self);
- GFile *icon = NULL;
- char *icon_path = NULL;
- gboolean result = FALSE;
priv->needs_save = FALSE;
biji_timeout_cancel (priv->timeout);
- result = BIJI_NOTE_OBJ_GET_CLASS (self)->archive (self);
- if (result == TRUE)
- {
- /* Delete icon file */
- icon_path = biji_note_obj_get_icon_file (self);
- icon = g_file_new_for_path (icon_path);
- g_file_delete (icon, NULL, NULL);
- }
-
- g_free (icon_path);
-
- if (icon != NULL)
- g_object_unref (icon);
-
- return result;
+ return BIJI_NOTE_OBJ_GET_CLASS (self)->archive (self);
}
gboolean
@@ -571,26 +554,6 @@ biji_note_obj_save_note (BijiNoteObj *self)
biji_timeout_reset (priv->timeout, 3000);
}
-char *
-biji_note_obj_get_icon_file (BijiNoteObj *self)
-{
- const char *uuid;
- char *basename, *filename;
-
- g_return_val_if_fail (BIJI_IS_NOTE_OBJ (self), NULL);
-
- uuid = BIJI_NOTE_OBJ_GET_CLASS (self)->get_basename (self);
- basename = biji_str_mass_replace (uuid, ".note", ".png", ".txt", ".png", NULL);
-
- filename = g_build_filename (g_get_user_cache_dir (),
- g_get_application_name (),
- basename,
- NULL);
-
- g_free (basename);
- return filename;
-}
-
static cairo_surface_t *
get_icon (BijiItem *item,
int scale)
diff --git a/src/libbiji/biji-note-obj.h b/src/libbiji/biji-note-obj.h
index dfd81fb..6024d69 100644
--- a/src/libbiji/biji-note-obj.h
+++ b/src/libbiji/biji-note-obj.h
@@ -124,11 +124,6 @@ gboolean biji_note_obj_is_trashed (BijiNoteObj *self)
void biji_note_obj_save_note (BijiNoteObj *self);
-void biji_note_obj_set_icon (BijiNoteObj *self,
- GdkPixbuf *pix);
-
-char *biji_note_obj_get_icon_file (BijiNoteObj *self);
-
const char *biji_note_obj_get_raw_text (BijiNoteObj *self);
void biji_note_obj_set_raw_text (BijiNoteObj *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]