[gnome-applets] sticky-notes: create unique name for each note



commit 141d03c861e988b680d93c445c43cf6d528cf02d
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Jul 24 15:57:40 2017 +0300

    sticky-notes: create unique name for each note

 sticky-notes/src/stickynotes.c |    6 ++++++
 sticky-notes/src/stickynotes.h |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/sticky-notes/src/stickynotes.c b/sticky-notes/src/stickynotes.c
index e289cb8..4ff56a6 100644
--- a/sticky-notes/src/stickynotes.c
+++ b/sticky-notes/src/stickynotes.c
@@ -135,6 +135,7 @@ stickynote_new_aux (GdkScreen *screen, gint x, gint y, gint w, gint h)
 {
        StickyNote *note;
        GtkBuilder *builder;
+       static guint id = 0;
 
        note = g_new (StickyNote, 1);
 
@@ -239,6 +240,9 @@ stickynote_new_aux (GdkScreen *screen, gint x, gint y, gint w, gint h)
        gtk_widget_show(note->w_close);
        gtk_widget_show(GTK_WIDGET (gtk_builder_get_object (builder, "resize_bar")));
 
+       note->name = g_strdup_printf ("sticky-note-%d", id++);
+       gtk_widget_set_name (note->w_window, note->name);
+
        /* Customize the title and colors, hide and unlock */
        stickynote_set_title(note, NULL);
        stickynote_set_color(note, NULL, NULL, TRUE);
@@ -330,6 +334,8 @@ void stickynote_free(StickyNote *note)
        gtk_widget_destroy(note->w_menu);
        gtk_widget_destroy(note->w_window);
 
+       g_free (note->name);
+
        g_free(note->color);
        g_free(note->font_color);
        g_free(note->font);
diff --git a/sticky-notes/src/stickynotes.h b/sticky-notes/src/stickynotes.h
index 0f5c9ef..c6eeb08 100644
--- a/sticky-notes/src/stickynotes.h
+++ b/sticky-notes/src/stickynotes.h
@@ -51,6 +51,8 @@ typedef struct
        GtkImage *img_resize_se;        /* SE resize image */
        GtkImage *img_resize_sw;        /* SW resize image */
 
+       gchar *name;
+
        gchar *color;                   /* Note color */
        gchar *font_color;              /* Font color */
        gchar *font;                    /* Note font */


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