aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--CMakeLists.txt2
-rw-r--r--ChangeLog68
-rw-r--r--NEWS25
-rw-r--r--debian/changelog32
-rw-r--r--src/idoscalemenuitem.c57
-rw-r--r--src/idoswitchmenuitem.c46
7 files changed, 217 insertions, 14 deletions
diff --git a/AUTHORS b/AUTHORS
index 5f8f46b..4661012 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -29,3 +29,4 @@ Robert Tari <robert@tari.in>
Sebastien Bacher <seb128@ubuntu.com>
Sylvain POULAIN <kikislater@users.noreply.github.com>
Ted Gould <ted@gould.cx>
+Till Maas <opensource@till.name>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 02a751c..0e13fcd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,7 +52,7 @@ pkg_check_modules(PROJECT_DEPS REQUIRED ${DEPS})
# Set global variables
include(GNUInstallDirs)
-set(PROJECT_VERSION "0.10.0")
+set(PROJECT_VERSION "0.10.4")
# Make everything
diff --git a/ChangeLog b/ChangeLog
index 7574a07..531e9a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,72 @@
+2024-08-22 Mike Gabriel
+
+ * release 0.10.4 (HEAD -> main, tag: 0.10.4)
+ * Merge branch 'tari01-pr/value-change-close' (4134bf3d)
+
+2024-07-17 Robert Tari
+
+ * src/idoscalemenuitem.c: Add ability to close the menu when the
+ slider's value changes (4446a18d)
+ * src/idoscalemenuitem.c: Disable menu item selection (1eaf28c9)
+
+2024-07-10 Mike Gabriel
+
+ * release 0.10.3 (9906cc1d) (tag: 0.10.3)
+ * Merge branch 'tari01-pr/switch-accelerator' (bd25ec74)
+
+2024-07-09 Robert Tari
+
+ * src/idoswitchmenuitem.c: Allow the switch to display an
+ accelerator. (255c93f5)
+
+2024-04-08 Mike Gabriel
+
+ * release 0.10.2 (2bb2f321) (tag: 0.10.2)
+ * Merge branch 'tari01-pr/expand-scale' (de33725f)
+
+2024-04-04 Robert Tari
+
+ * src/idoscalemenuitem.c: Add new functionality via the digits and
+ marks parameters (451a9efb)
+ * src/idoscalemenuitem.c: Make page increment same as step increment
+ (87715f3f)
+
+2023-08-24 Mike Gabriel
+
+ * release 0.10.1 (13402a2c) (tag: 0.10.1)
+ * COPYING: Symlink to COPYING.GPL-3, the licensed used by the
+ majority of code files. (c9bfd1b5)
+ * Rename COPYING to COPYING.GPL-3 and use Debian's version of it.
+ (cc276098)
+ * COPYING files: Ship a copy of LGPL-2(+) and LGPL-3. Some code files
+ in this project use either of those licenses. (b040a375)
+ * COPYING.LGPL.2.1: Rename to COPYING.LGPL-2.1 (and use layout from
+ Debian's LGPL-2.1 license file shipped in
+ /usr/share/common-licenses/). (20d65627)
+ * Merge branch 'tyll-executable_so' (39277de1)
+
+2023-08-24 Till Maas
+
+ * cmake: Install library as library (610ddb96)
+
+2023-08-07 Mike Gabriel
+
+ * Merge branch 'tari01-pr/no-hardcoded-icon-sizes' (b1998c6a)
+
+2023-08-05 Robert Tari
+
+ * Do not hardcode icon sizes (e487b162)
+ * Fix possible memory leaks (ebb915b5)
+ * src/idoalarmmenuitem.c: Do not free non memory-allocated variable
+ (579cad6e)
+ * src/idoplaybackmenuitem.c: Drop unused variable (c2bade07)
+ * src/idoplaybackmenuitem.c: Fix undefined variable (be68b43c)
+
2023-06-09 Mike Gabriel
- * release 0.10.0 (HEAD -> main, tag: 0.10.0)
+ * d/libayatana-ido3-0.4-0.symbols: Update symbols. (09c5052d)
+ * d/changelog: amend revision (5263257c)
+ * release 0.10.0 (75f61898) (tag: 0.10.0)
2023-05-05 Mike Gabriel
diff --git a/NEWS b/NEWS
index 206e97b..92119fd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,28 @@
+Overview of changes in ayatana-ido 0.10.4
+
+ - src/idoscalemenuitem.c: Disable menu item selection
+ - src/idoscalemenuitem.c: Add ability to close the menu when the
+ slider's value changes.
+
+Overview of changes in ayatana-ido 0.10.3
+
+ - src/idoswitchmenuitem.c: Allow the switch to display an
+ accelerator.
+
+Overview of changes in ayatana-ido 0.10.2
+
+ - src/idoscalemenuitem.c: Make page increment same as step increment.
+ - src/idoscalemenuitem.c: Add new functionality via the digits and
+ marks parameters.
+
+Overview of changes in ayatana-ido 0.10.1
+
+ - src/idoalarmmenuitem.c: Do not free non memory-allocated variable
+ - Fix possible memory leaks.
+ - Do not hardcode icon sizes.
+ - cmake: Install library as library.
+ - Update/add COPYING files, ship COPYING files for all licensed used.
+
Overview of changes in ayatana-ido 0.10.0
- Add level menu item.
diff --git a/debian/changelog b/debian/changelog
index af6fe0a..8edbc4f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,37 @@
-ayatana-ido (0.10.0-0) UNRELEASED; urgency=medium
+ayatana-ido (0.10.4-0) unstable; urgency=medium
* Upstream-provided Debian package for ayatana-ido.
See upstream ChangeLog for recent changes.
- -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Fri, 09 Jun 2023 07:55:31 +0200
+ -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Thu, 22 Aug 2024 11:29:23 +0200
+
+ayatana-ido (0.10.3-0) unstable; urgency=medium
+
+ * Upstream-provided Debian package for ayatana-ido.
+ See upstream ChangeLog for recent changes.
+
+ -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Wed, 10 Jul 2024 13:31:20 +0200
+
+ayatana-ido (0.10.2-0) unstable; urgency=medium
+
+ * Upstream-provided Debian package for ayatana-ido.
+ See upstream ChangeLog for recent changes.
+
+ -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Mon, 08 Apr 2024 12:01:46 +0200
+
+ayatana-ido (0.10.1-0) unstable; urgency=medium
+
+ * Upstream-provided Debian package for ayatana-ido.
+ See upstream ChangeLog for recent changes.
+
+ -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Thu, 24 Aug 2023 17:06:52 +0200
+
+ayatana-ido (0.10.0-0) unstable; urgency=medium
+
+ * Upstream-provided Debian package for ayatana-ido.
+ See upstream ChangeLog for recent changes.
+
+ -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Fri, 09 Jun 2023 08:01:24 +0200
ayatana-ido (0.9.3-0) unstable; urgency=medium
diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c
index 37a9385..50c323a 100644
--- a/src/idoscalemenuitem.c
+++ b/src/idoscalemenuitem.c
@@ -1,6 +1,6 @@
/*
* Copyright 2010 Canonical, Ltd.
- * Copyright 2021 Robert Tari
+ * Copyright 2021-2024 Robert Tari
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of either or both of the following licenses:
@@ -26,6 +26,7 @@
*/
#include <gtk/gtk.h>
+#include <math.h>
#include "idorange.h"
#include "idoscalemenuitem.h"
#include "idotypebuiltins.h"
@@ -77,6 +78,7 @@ typedef struct {
IdoRangeStyle range_style;
gboolean ignore_value_changed;
gboolean has_focus;
+ gboolean bCloseOnChange;
} IdoScaleMenuItemPrivate;
enum {
@@ -142,8 +144,16 @@ ido_scale_menu_item_scale_value_changed (GtkRange *range,
/* The signal is not sent when it was set through
* ido_scale_menu_item_set_value(). */
- if (!priv->ignore_value_changed)
- g_signal_emit (self, signals[VALUE_CHANGED], 0, gtk_range_get_value (range));
+ if (!priv->ignore_value_changed)
+ {
+ g_signal_emit (self, signals[VALUE_CHANGED], 0, gtk_range_get_value (range));
+
+ if (priv->bCloseOnChange)
+ {
+ GtkWidget *pParent = gtk_widget_get_parent (GTK_WIDGET (self));
+ gtk_menu_shell_deactivate (GTK_MENU_SHELL (pParent));
+ }
+ }
}
static void
@@ -366,7 +376,7 @@ static void
ido_scale_menu_item_init (IdoScaleMenuItem *self)
{
IdoScaleMenuItemPrivate *priv = ido_scale_menu_item_get_instance_private (self);
-
+ priv->bCloseOnChange = FALSE;
priv->reverse_scroll = TRUE;
gtk_widget_set_size_request (GTK_WIDGET (self), 200, -1);
@@ -474,8 +484,6 @@ ido_scale_menu_item_select (GtkMenuItem *item)
priv->has_focus = TRUE;
gtk_widget_set_state_flags (priv->scale, GTK_STATE_FLAG_FOCUSED, FALSE);
-
- GTK_MENU_ITEM_CLASS (ido_scale_menu_item_parent_class)->select (item);
}
static void
@@ -486,8 +494,6 @@ ido_scale_menu_item_deselect (GtkMenuItem *item)
priv->has_focus = FALSE;
gtk_widget_unset_state_flags (priv->scale, GTK_STATE_FLAG_FOCUSED);
-
- GTK_MENU_ITEM_CLASS (ido_scale_menu_item_parent_class)->deselect (item);
}
static gboolean
@@ -701,7 +707,7 @@ ido_scale_menu_item_new_with_range (const gchar *label,
gdouble max,
gdouble step)
{
- GObject *adjustment = G_OBJECT (gtk_adjustment_new (value, min, max, step, 10 * step, 0));
+ GObject *adjustment = G_OBJECT (gtk_adjustment_new (value, min, max, step, step, 0));
return GTK_WIDGET (g_object_new (IDO_TYPE_SCALE_MENU_ITEM,
"label", label,
@@ -1048,6 +1054,13 @@ menu_item_get_icon (GMenuItem *menuitem,
return value ? g_icon_deserialize (value) : NULL;
}
+static gchar* onFormatValue (GtkScale *pScale, gdouble fValue)
+{
+ gint nValue = fValue * 100;
+ gchar *sValue = g_strdup_printf ("%i%%", nValue);
+
+ return sValue;
+}
/**
* ido_scale_menu_item_new_from_model:
*
@@ -1089,6 +1102,32 @@ ido_scale_menu_item_new_from_model (GMenuItem *menuitem,
g_free (action);
}
+ IdoScaleMenuItemPrivate *pPrivate = ido_scale_menu_item_get_instance_private (IDO_SCALE_MENU_ITEM (item));
+ guchar nDigits = 0;
+ gboolean bFound = g_menu_item_get_attribute (menuitem, "digits", "y", &nDigits);
+
+ if (bFound)
+ {
+ gtk_scale_set_digits (GTK_SCALE (pPrivate->scale), nDigits);
+ gtk_range_set_round_digits (GTK_RANGE (pPrivate->scale), nDigits);
+ }
+
+ gboolean bMarks = FALSE;
+ bFound = g_menu_item_get_attribute (menuitem, "marks", "b", &bMarks);
+
+ if (bFound)
+ {
+ gtk_scale_set_draw_value (GTK_SCALE (pPrivate->scale), TRUE);
+
+ for (gdouble fValue = min; fValue < (max + step); fValue += step)
+ {
+ gtk_scale_add_mark (GTK_SCALE (pPrivate->scale), round (fValue * 10) / 10, GTK_POS_BOTTOM, NULL);
+ }
+
+ g_signal_connect (pPrivate->scale, "format-value", G_CALLBACK (onFormatValue), NULL);
+ }
+
+ g_menu_item_get_attribute (menuitem, "close-on-change", "b", &pPrivate->bCloseOnChange);
min_icon = menu_item_get_icon (menuitem, "min-icon");
max_icon = menu_item_get_icon (menuitem, "max-icon");
ido_scale_menu_item_set_icons (IDO_SCALE_MENU_ITEM (item), min_icon, max_icon);
diff --git a/src/idoswitchmenuitem.c b/src/idoswitchmenuitem.c
index 9bc9ef9..af90d7b 100644
--- a/src/idoswitchmenuitem.c
+++ b/src/idoswitchmenuitem.c
@@ -33,6 +33,7 @@ typedef struct
GtkWidget * label;
GtkWidget * image;
GtkWidget * switch_w;
+ GtkWidget * accelerator;
} IdoSwitchMenuItemPrivate;
/***
@@ -168,13 +169,47 @@ ido_switch_menu_item_set_label (IdoSwitchMenuItem *item,
priv->label = gtk_label_new (NULL);
gtk_widget_set_halign (priv->label, GTK_ALIGN_START);
gtk_widget_show (priv->label);
- gtk_box_pack_end (GTK_BOX (priv->content_area), priv->label, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->content_area), priv->label, TRUE, TRUE, 0);
}
gtk_label_set_text (GTK_LABEL (priv->label), label);
}
/**
+ * ido_switch_menu_item_set_accelerator:
+ * @item: a #IdoSwitchMenuItem.
+ * @accelerator: a string to set as the accelerator of @item
+ *
+ * Set the accelerator of @item to @accelerator.
+ **/
+
+void ido_switch_menu_item_set_accelerator (IdoSwitchMenuItem *item, const gchar *accelerator)
+{
+ IdoSwitchMenuItemPrivate *priv;
+
+ g_return_if_fail (IDO_IS_SWITCH_MENU_ITEM (item));
+ g_return_if_fail (accelerator != NULL);
+
+ priv = ido_switch_menu_item_get_instance_private (item);
+
+ if (priv->accelerator == NULL)
+ {
+ priv->accelerator = gtk_label_new (NULL);
+ gtk_widget_set_halign (priv->accelerator, GTK_ALIGN_END);
+ GtkStyleContext *pContext = gtk_widget_get_style_context (priv->accelerator);
+ gtk_style_context_add_class (pContext, "accelerator");
+ gtk_widget_show (priv->accelerator);
+ gtk_box_pack_end (GTK_BOX (priv->content_area), priv->accelerator, FALSE, FALSE, 6);
+ }
+
+ guint nKey;
+ GdkModifierType cType;
+ gtk_accelerator_parse (accelerator, &nKey, &cType);
+ gchar *sText = gtk_accelerator_get_label (nKey, cType);
+ gtk_label_set_text (GTK_LABEL (priv->accelerator), sText);
+}
+
+/**
* ido_switch_menu_item_set_icon:
* @item: a #IdoSwitchMenuItem.
* @icon: (allow-none): a #GIcon
@@ -248,6 +283,15 @@ ido_switch_menu_item_new_from_menu_model (GMenuItem *menuitem,
g_free (label);
}
+ gchar *sAccelerator;
+ gboolean bAccelerator = g_menu_item_get_attribute (menuitem, "accel", "s", &sAccelerator);
+
+ if (bAccelerator)
+ {
+ ido_switch_menu_item_set_accelerator (IDO_SWITCH_MENU_ITEM (item), sAccelerator);
+ g_free (sAccelerator);
+ }
+
serialized_icon = g_menu_item_get_attribute_value (menuitem, "icon", NULL);
if (serialized_icon)
{