diff --git a/audio-recorder-1.4-1.tar.gz b/audio-recorder-1.4-1.tar.gz deleted file mode 100644 index fa40faa..0000000 --- a/audio-recorder-1.4-1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:54e55d2efa9a0019e1c7220e3ce099c8fac5e49f5741a811a59eba550ce6f23b -size 8189035 diff --git a/audio-recorder-1.6-2.tar.gz b/audio-recorder-1.6-2.tar.gz new file mode 100644 index 0000000..4482d46 --- /dev/null +++ b/audio-recorder-1.6-2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12974217fa1d03bf568b6578744dce14e76982814bed0e6729be731779ffce16 +size 8657059 diff --git a/audio-recorder-automake.patch b/audio-recorder-automake.patch deleted file mode 100644 index 12155c6..0000000 --- a/audio-recorder-automake.patch +++ /dev/null @@ -1,14 +0,0 @@ -Index: audio-recorder/configure.ac -=================================================================== ---- audio-recorder.orig/configure.ac -+++ audio-recorder/configure.ac -@@ -1,8 +1,8 @@ - # ================= initialization =================== # - AC_INIT([Audio Recorder], [1.4-1], [https://bugs.launchpad.net/audio-recorder/+filebug], [audio-recorder]) -+AM_INIT_AUTOMAKE - - AC_USE_SYSTEM_EXTENSIONS --AM_INIT_AUTOMAKE - AC_CONFIG_SRCDIR([src/main.c]) - #AC_CONFIG_HEADERS([src/config.h]) - AM_MAINTAINER_MODE diff --git a/audio-recorder-gtk-3.16.patch b/audio-recorder-gtk-3.16.patch new file mode 100644 index 0000000..92966d2 --- /dev/null +++ b/audio-recorder-gtk-3.16.patch @@ -0,0 +1,1393 @@ +=== modified file 'ChangeLog' +Index: Makefile.in +=================================================================== +--- Makefile.in.orig ++++ Makefile.in +@@ -237,7 +237,6 @@ CXX = @CXX@ + CXXDEPMODE = @CXXDEPMODE@ + CXXFLAGS = @CXXFLAGS@ + CYGPATH_W = @CYGPATH_W@ +-DATADIRNAME = @DATADIRNAME@ + DBUS_CFLAGS = @DBUS_CFLAGS@ + DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ +Index: aclocal.m4 +=================================================================== +--- aclocal.m4.orig ++++ aclocal.m4 +@@ -238,31 +238,6 @@ fi + # Substitute ALL_LINGUAS so we can use it in po/Makefile + AC_SUBST(ALL_LINGUAS) + +-# Set DATADIRNAME correctly if it is not set yet +-# (copied from glib-gettext.m4) +-if test -z "$DATADIRNAME"; then +- AC_LINK_IFELSE( +- [AC_LANG_PROGRAM([[]], +- [[extern int _nl_msg_cat_cntr; +- return _nl_msg_cat_cntr]])], +- [DATADIRNAME=share], +- [case $host in +- *-*-solaris*) +- dnl On Solaris, if bind_textdomain_codeset is in libc, +- dnl GNU format message catalog is always supported, +- dnl since both are added to the libc all together. +- dnl Hence, we'd like to go with DATADIRNAME=share +- dnl in this case. +- AC_CHECK_FUNC(bind_textdomain_codeset, +- [DATADIRNAME=share], [DATADIRNAME=lib]) +- ;; +- *) +- [DATADIRNAME=lib] +- ;; +- esac]) +-fi +-AC_SUBST(DATADIRNAME) +- + IT_PO_SUBDIR([po]) + + ]) +Index: configure +=================================================================== +--- configure.orig ++++ configure +@@ -631,7 +631,6 @@ GSETTINGS_RULES + GLIB_COMPILE_SCHEMAS + gsettingsschemadir + GSETTINGS_DISABLE_SCHEMAS_COMPILE +-DATADIRNAME + ALL_LINGUAS + INTLTOOL_PERL + GMSGFMT +@@ -8056,44 +8055,6 @@ fi + # Substitute ALL_LINGUAS so we can use it in po/Makefile + + +-# Set DATADIRNAME correctly if it is not set yet +-# (copied from glib-gettext.m4) +-if test -z "$DATADIRNAME"; then +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-int +-main () +-{ +-extern int _nl_msg_cat_cntr; +- return _nl_msg_cat_cntr +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_link "$LINENO"; then : +- DATADIRNAME=share +-else +- case $host in +- *-*-solaris*) +- ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" +-if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : +- DATADIRNAME=share +-else +- DATADIRNAME=lib +-fi +- +- ;; +- *) +- DATADIRNAME=lib +- ;; +- esac +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +-fi +- +- + + + +Index: data/Makefile.in +=================================================================== +--- data/Makefile.in.orig ++++ data/Makefile.in +@@ -157,7 +157,6 @@ CXX = @CXX@ + CXXDEPMODE = @CXXDEPMODE@ + CXXFLAGS = @CXXFLAGS@ + CYGPATH_W = @CYGPATH_W@ +-DATADIRNAME = @DATADIRNAME@ + DBUS_CFLAGS = @DBUS_CFLAGS@ + DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ +Index: icons/Makefile.in +=================================================================== +--- icons/Makefile.in.orig ++++ icons/Makefile.in +@@ -185,7 +185,6 @@ CXX = @CXX@ + CXXDEPMODE = @CXXDEPMODE@ + CXXFLAGS = @CXXFLAGS@ + CYGPATH_W = @CYGPATH_W@ +-DATADIRNAME = @DATADIRNAME@ + DBUS_CFLAGS = @DBUS_CFLAGS@ + DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ +Index: icons/hicolor/Makefile.in +=================================================================== +--- icons/hicolor/Makefile.in.orig ++++ icons/hicolor/Makefile.in +@@ -185,7 +185,6 @@ CXX = @CXX@ + CXXDEPMODE = @CXXDEPMODE@ + CXXFLAGS = @CXXFLAGS@ + CYGPATH_W = @CYGPATH_W@ +-DATADIRNAME = @DATADIRNAME@ + DBUS_CFLAGS = @DBUS_CFLAGS@ + DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ +Index: icons/hicolor/scalable/Makefile.in +=================================================================== +--- icons/hicolor/scalable/Makefile.in.orig ++++ icons/hicolor/scalable/Makefile.in +@@ -185,7 +185,6 @@ CXX = @CXX@ + CXXDEPMODE = @CXXDEPMODE@ + CXXFLAGS = @CXXFLAGS@ + CYGPATH_W = @CYGPATH_W@ +-DATADIRNAME = @DATADIRNAME@ + DBUS_CFLAGS = @DBUS_CFLAGS@ + DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ +Index: icons/hicolor/scalable/apps/Makefile.in +=================================================================== +--- icons/hicolor/scalable/apps/Makefile.in.orig ++++ icons/hicolor/scalable/apps/Makefile.in +@@ -155,7 +155,6 @@ CXX = @CXX@ + CXXDEPMODE = @CXXDEPMODE@ + CXXFLAGS = @CXXFLAGS@ + CYGPATH_W = @CYGPATH_W@ +-DATADIRNAME = @DATADIRNAME@ + DBUS_CFLAGS = @DBUS_CFLAGS@ + DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ +Index: icons/hicolor/scalable/status/Makefile.in +=================================================================== +--- icons/hicolor/scalable/status/Makefile.in.orig ++++ icons/hicolor/scalable/status/Makefile.in +@@ -155,7 +155,6 @@ CXX = @CXX@ + CXXDEPMODE = @CXXDEPMODE@ + CXXFLAGS = @CXXFLAGS@ + CYGPATH_W = @CYGPATH_W@ +-DATADIRNAME = @DATADIRNAME@ + DBUS_CFLAGS = @DBUS_CFLAGS@ + DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ +Index: pixmaps/Makefile.in +=================================================================== +--- pixmaps/Makefile.in.orig ++++ pixmaps/Makefile.in +@@ -157,7 +157,6 @@ CXX = @CXX@ + CXXDEPMODE = @CXXDEPMODE@ + CXXFLAGS = @CXXFLAGS@ + CYGPATH_W = @CYGPATH_W@ +-DATADIRNAME = @DATADIRNAME@ + DBUS_CFLAGS = @DBUS_CFLAGS@ + DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ +Index: po/POTFILES.in +=================================================================== +--- po/POTFILES.in.orig ++++ po/POTFILES.in +@@ -24,8 +24,8 @@ src/gst-pipeline.c + src/gst-pipeline.h + src/gst-recorder.c + src/gst-recorder.h +-src/gtklevelbar.c +-src/gtklevelbar.h ++src/levelbar.c ++src/levelbar.h + src/help.c + src/help.h + src/log.c +Index: src/Makefile.am +=================================================================== +--- src/Makefile.am.orig ++++ src/Makefile.am +@@ -43,7 +43,7 @@ audio_recorder_SOURCES = rec-window.h co + utility.c utility.h \ + settings.c settings-pipe.c settings.h \ + about.c about.h \ +- gtklevelbar.c gtklevelbar.h \ ++ levelbar.c levelbar.h \ + main.c + + +Index: src/Makefile.in +=================================================================== +--- src/Makefile.in.orig ++++ src/Makefile.in +@@ -98,7 +98,7 @@ am_audio_recorder_OBJECTS = systray-icon + gst-devices.$(OBJEXT) rec-manager.$(OBJEXT) support.$(OBJEXT) \ + timer.$(OBJEXT) timer-parser.$(OBJEXT) utility.$(OBJEXT) \ + settings.$(OBJEXT) settings-pipe.$(OBJEXT) about.$(OBJEXT) \ +- gtklevelbar.$(OBJEXT) main.$(OBJEXT) ++ levelbar.$(OBJEXT) main.$(OBJEXT) + audio_recorder_OBJECTS = $(am_audio_recorder_OBJECTS) + audio_recorder_LDADD = $(LDADD) + AM_V_P = $(am__v_P_@AM_V@) +@@ -175,7 +175,6 @@ CXX = @CXX@ + CXXDEPMODE = @CXXDEPMODE@ + CXXFLAGS = @CXXFLAGS@ + CYGPATH_W = @CYGPATH_W@ +-DATADIRNAME = @DATADIRNAME@ + DBUS_CFLAGS = @DBUS_CFLAGS@ + DBUS_LIBS = @DBUS_LIBS@ + DEFS = @DEFS@ +@@ -329,7 +328,7 @@ audio_recorder_SOURCES = rec-window.h co + utility.c utility.h \ + settings.c settings-pipe.c settings.h \ + about.c about.h \ +- gtklevelbar.c gtklevelbar.h \ ++ levelbar.c levelbar.h \ + main.c + + all: all-am +@@ -431,8 +430,8 @@ distclean-compile: + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gst-pipeline.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gst-recorder.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gst-vad.Po@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtklevelbar.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/levelbar.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/media-profiles.Po@am__quote@ +Index: src/audio-sources.c +=================================================================== +--- src/audio-sources.c.orig ++++ src/audio-sources.c +@@ -687,7 +687,7 @@ void audio_source_fill_combo(GtkWidget * + GdkPixbuf *pixbuf = NULL; + if (item->type == MEDIA_PLAYER || item->type == COMM_PROGRAM) { + +- pixbuf = load_icon_pixbuf((gchar*)p); ++ pixbuf = load_icon_pixbuf((gchar*)p, 22); + + // Got icon?? + if (!GDK_IS_PIXBUF(pixbuf)) { +Index: src/dbus-mpris2.c +=================================================================== +--- src/dbus-mpris2.c.orig ++++ src/dbus-mpris2.c +@@ -3,10 +3,7 @@ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public +- * License as published by the Free Software Foundation; either +- * version 3 of the License (GPL3), or any later version. +- * +- * This library is distributed in the hope that it will be useful, ++ * License as published by the Free Software Foundation; either"OK + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Library General Public License 3 for more details. +@@ -573,6 +570,20 @@ GVariant *mpris2_get_player_value(gpoint + return res; + } + ++#if 0 ++void debug_variant(const gchar *tag, GVariant *v) { ++ if (!v) { ++ g_print("%s is NULL.\n", tag); ++ return; ++ } ++ ++ gchar *sval = g_variant_print(v, TRUE); ++ const gchar *stype = g_variant_get_type_string(v); ++ g_print("%s has type:%s and value:%s\n", tag, stype, sval); ++ g_free(sval); ++} ++#endif ++ + void mpris2_get_metadata(gpointer player_rec) { + // Get track information (=metadata) and state for the given media player. + // Ref: http://www.mpris.org/2.1/spec/Player_Node.html#Property:Metadata +@@ -602,6 +613,8 @@ void mpris2_get_metadata(gpointer player + // + GVariant *result = mpris2_get_player_value(player, "PlaybackStatus"); + ++ // DEBUG: debug_variant("PlaybackStatus", result); ++ + if (!result) { + // Cannot contact player (it has quit)? + tr->status = PLAYER_STATUS_CLOSED; +@@ -657,9 +670,14 @@ void mpris2_get_metadata(gpointer player + // + GVariant *dict = mpris2_get_player_value(player, "Metadata"); + ++ // DEBUG: debug_variant("Metadata", dict); ++ + if (!dict) { +- // Cannot contact player (it has quit)? +- tr->status = PLAYER_STATUS_CLOSED; ++ // Cannot get Metadata (should we consider this as on error?) ++ // 03.april.2015, commented out by MOma: Ambient Noise Player does not support "Metadata" yet. ++ ++ // tr->status = PLAYER_STATUS_CLOSED; ++ + return; + } + +Index: src/gtklevelbar.c +=================================================================== +--- src/gtklevelbar.c ++++ /dev/null +@@ -1,357 +0,0 @@ +-/* +- * Copyright (c) Linux community. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Library General Public +- * License as published by the Free Software Foundation; either +- * version 3 of the License (GPL3), or any later version. +- * +- * This library 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 Library General Public License 3 for more details. +- * +- * You should have received a copy of the GNU Library General Public +- * License 3 along with this program; if not, see /usr/share/common-licenses/GPL file +- * or write to Free Software Foundation, Inc., 59 Temple Place - Suite 330, +- * Boston, MA 02111-1307, USA. +-*/ +-#include "gtklevelbar.h" +-#include // round() +- +-// A simple level bar widget. +-// By Osmo Antero. +-// +-// Sample call: +-// GtkWidget *lb = gtk_level_bar_new(); +-// gtk_widget_show(lb); +-// +-// Set value [0.0, 1.0]. +-// gtk_level_bar_set_fraction(GTK_LEVEL_BAR(lb), 0.8); +-// +-// Show %-value [0 - 100%] or plain value [0 - 1.0] on the level bar. See BAR_VALUE enum. +-// gtk_level_bar_set_value_type(GTK_LEVEL_BAR(lb), VALUE_PRECENT); +-// +- +-struct _GtkLevelBarPrivate { +- gdouble fraction; +- guint bar_height; +- enum BAR_VALUE bar_value; +- enum BAR_SHAPE bar_shape; +-}; +- +-static void gtk_level_bar_get_preferred_width(GtkWidget *widget, gint *minimum, gint *natural); +-static void gtk_level_bar_get_preferred_height (GtkWidget *widget,gint *minimum, gint *natural); +- +-static void gtk_level_bar_real_update(GtkLevelBar *progress); +-static gboolean gtk_level_bar_draw(GtkWidget *widget, cairo_t *cr); +- +-static void gtk_level_bar_finalize(GObject *object); +- +-G_DEFINE_TYPE(GtkLevelBar, gtk_level_bar, GTK_TYPE_WIDGET); +- +-static void gtk_level_bar_class_init (GtkLevelBarClass *class) { +- GObjectClass *gobject_class; +- GtkWidgetClass *widget_class; +- +- gobject_class = G_OBJECT_CLASS (class); +- widget_class = (GtkWidgetClass *)class; +- +- gobject_class->set_property = NULL; +- gobject_class->get_property = NULL; +- gobject_class->finalize = gtk_level_bar_finalize; +- +- widget_class->draw = gtk_level_bar_draw; +- widget_class->get_preferred_width = gtk_level_bar_get_preferred_width; +- widget_class->get_preferred_height = gtk_level_bar_get_preferred_height; +- +- g_type_class_add_private (class, sizeof (GtkLevelBarPrivate)); +-} +- +-static void gtk_level_bar_init(GtkLevelBar *pbar) { +- GtkLevelBarPrivate *priv; +- +- pbar->priv = G_TYPE_INSTANCE_GET_PRIVATE(pbar, GTK_TYPE_LEVEL_BAR, GtkLevelBarPrivate); +- priv = pbar->priv; +- +- priv->fraction = 0.0; +- priv->bar_height = 8; +- priv->bar_value = VALUE_NONE; +- priv->bar_shape = SHAPE_CIRCLE; // pulsing line with circle at end. +- +- gtk_widget_set_has_window(GTK_WIDGET (pbar), FALSE); +-} +- +-GtkWidget *gtk_level_bar_new(void) { +- GtkWidget *pbar; +- pbar = g_object_new(GTK_TYPE_LEVEL_BAR, NULL); +- return pbar; +-} +- +-static void gtk_level_bar_real_update (GtkLevelBar *pbar) { +- GtkWidget *widget; +- +- g_return_if_fail (GTK_IS_LEVEL_BAR (pbar)); +- +- GtkLevelBarPrivate __attribute__ ((unused)) *priv = pbar->priv; +- +- widget = GTK_WIDGET(pbar); +- +- gtk_widget_queue_draw(widget); +-} +- +-static void gtk_level_bar_finalize (GObject *object) { +- G_OBJECT_CLASS(gtk_level_bar_parent_class)->finalize (object); +-} +- +-static void gtk_level_bar_get_preferred_width (GtkWidget *widget,gint *minimum, gint *natural) { +- *minimum = 50; +- *natural = 160; +-} +- +-static void gtk_level_bar_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural) { +- *minimum = 6; +- *natural = 8; +-} +- +-static gboolean gtk_level_bar_draw(GtkWidget *widget, cairo_t *cr) { +- // Draw level bar and optional text +- GtkLevelBar *pbar = GTK_LEVEL_BAR (widget); +- GtkLevelBarPrivate *priv = pbar->priv; +- GtkStyleContext *context; +- int width, height; +- +- context = gtk_widget_get_style_context(widget); +- +- width = gtk_widget_get_allocated_width(widget); +- height = gtk_widget_get_allocated_height(widget); +- +- // Bar thickness +- gdouble bar_height = MIN(height , priv->bar_height); +- +- // Vertical pos +- gdouble y = (height - bar_height)/2; +- +- // Pulse width +- gdouble w = priv->fraction/(1.00/width); +- +- // Debug: +- // LOG_DEBUG("width=%d height=%d bar_height=%2.1f y=%2.1f w=%2.1f fraction=%2.1f\n", width, height, bar_height, y, w, priv->fraction); +- +- gtk_style_context_save(context); +- gtk_render_background(context, cr, 0, 0, width, height); +- gtk_render_frame(context, cr, 0, 0, width, height); +- +- // Render level bar with current theme and color. +- +- // Progressbar style +- gtk_style_context_add_class(context, GTK_STYLE_CLASS_PROGRESSBAR); +- +- if (priv->fraction > 0.001) { +- +- switch (priv->bar_shape) { +- +- case SHAPE_LINE: +- // Render a single line +- if (priv->bar_value == VALUE_NONE) { +- // No value (text) shown. Draw a line on the middle. +- gtk_render_line(context, cr, 0, y + (bar_height / 2), w, y + (bar_height / 2)); +- +- } else { +- // Draw a line under text. +- gtk_render_line(context, cr, 0, y + (bar_height ), w, y + (bar_height )); +- } +- +- break; +- +- case SHAPE_LINE2: +- // Render two horizontal lines + close the end. +- gtk_render_line(context, cr, 0, y-1 , w, y-1); +- gtk_render_line(context, cr, 0, y + (bar_height ), w, y + (bar_height )); +- gtk_render_line(context, cr, w, y - 1, w, y + (bar_height )); +- break; +- +- case SHAPE_CIRCLE: +- // Draw a line on the middle + circle at the end. +- gtk_render_line(context, cr, 0, y + (bar_height / 2), w, y + (bar_height / 2)); +- gtk_render_option(context, cr, w, y, bar_height+1, bar_height+1); +- break; +- +- default: +- // case SHAPE_LEVELBAR: +- +- // EDIT: gtk_render_activity() does not work in GTK 3.14+ +- // gtk_style_context_set_state(context, GTK_STATE_FLAG_ACTIVE); +- // gtk_render_activity(context, cr, 0, y, w, bar_height); +- +- // Render a filled frame (this is a typical levelbar). +- gtk_render_frame(context, cr, 0, y, w, bar_height); +- break; +- +- } +- } +- +- gtk_style_context_restore(context); +- +- cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); +- cairo_set_font_size(cr, priv->bar_height); +- +- GdkRGBA color; +- gtk_style_context_get_border_color(context, GTK_STATE_NORMAL, &color); +- gdk_cairo_set_source_rgba(cr, &color); +- color.alpha = 0.9; +- +- // Calculate total width of scale +- cairo_text_extents_t extents; +- cairo_text_extents(cr, "0.0", &extents); +- gint total_w = 9 * (extents.x_advance + extents.width); +- +- // Debug: +- // g_print("Bar width=%d total_w=%d bearing=%3.1f advance=%3.1f char.width=%3.1f\n", width, total_w, +- // extents.x_bearing, extents.x_advance, extents.width); +- +- // Draw values +- gboolean draw_all = (total_w - extents.width) < width; +- +- // Show normalized value [0 - 1.0]? +- if (priv->bar_value == VALUE_0_1) { +- // Value: 0.1 0.2 0.3 0.4...0.9 +- +- gint i = 0; +- for (i=0; i < 10; i++) { +- gchar *s = NULL; +- +- // Draw all or draw only each second value? +- if (draw_all || (i % 2 == 0)) +- s = g_strdup_printf("%2.1f", (gdouble)i/10.0); +- +- if (!s) continue; +- +- cairo_text_extents_t extents; +- cairo_text_extents(cr, s, &extents); +- +- gdouble xx = (width/10) * i; +- gdouble yy = (height/2)-(extents.height/2 + extents.y_bearing) + 0.2; +- +- cairo_move_to(cr, xx, yy); +- cairo_show_text(cr, s); +- +- g_free(s); +- } +- +- // Show percentage value? +- } else if (priv->bar_value == VALUE_PERCENT) { +- // Value: 10% . 20% . 30% . 40% . 50% ... 90% +- gint i = 0; +- for (i=0; i < 10; i++) { +- gchar *s = NULL; +- if (i % 2 == 0) +- s = g_strdup_printf("%2.0f%%", (gdouble)i*10.0); +- else +- s = g_strdup_printf("%3s", "."); +- +- cairo_text_extents_t extents; +- cairo_text_extents(cr, s, &extents); +- +- gdouble xx = (width/10) * i; +- gdouble yy = (height/2)-(extents.height/2 + extents.y_bearing); +- +- cairo_move_to(cr, xx, yy); +- cairo_show_text(cr, s); +- +- g_free(s); +- } +- } +- +-#if 0 +- // Commented out by moma 30.sep.2012. +- +- // Set text +- if (priv->text) { +- cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); +- +- cairo_set_font_size(cr, 0.5*height); +- cairo_text_extents_t extents; +- cairo_text_extents(cr, priv->text, &extents); +- +- // Ref: http://cairographics.org/manual/cairo-cairo-scaled-font-t.html#cairo-text-extents-t +- gdouble xx = width-(extents.width + extents.x_bearing)-2; +- gdouble yy = height/2-(extents.height/2 + extents.y_bearing); +- +- GdkRGBA color; +- gtk_style_context_get_border_color(context, GTK_STATE_NORMAL, &color); +- gdk_cairo_set_source_rgba(cr, &color); +- color.alpha = 0.9; +- +- cairo_move_to(cr, xx, yy); +- cairo_show_text(cr, priv->text); +- } +-#endif +- +- return FALSE; +-} +- +-void gtk_level_bar_set_fraction(GtkLevelBar *pbar, gdouble fraction) { +- // Set fraction [0.0, 1.0] +- GtkLevelBarPrivate* priv; +- g_return_if_fail (GTK_IS_LEVEL_BAR (pbar)); +- priv = pbar->priv; +- +- priv->fraction = CLAMP(fraction, 0.0, 1.0); +- gtk_level_bar_real_update (pbar); +-} +- +-gdouble gtk_level_bar_get_fraction(GtkLevelBar *pbar) { +- // Get fraction +- g_return_val_if_fail(GTK_IS_LEVEL_BAR (pbar), 0); +- return pbar->priv->fraction; +-} +- +-void gtk_level_bar_set_bar_height(GtkLevelBar *pbar, guint height) { +- // Set bar height (thickness). Normally 8 pixels. +- g_return_if_fail(GTK_IS_LEVEL_BAR (pbar)); +- GtkLevelBarPrivate* priv = pbar->priv; +- priv->bar_height = height; +- // Redraw +- gtk_level_bar_real_update(pbar); +-} +- +-guint gtk_level_bar_get_bar_height(GtkLevelBar *pbar) { +- // Get bar thickness +- g_return_val_if_fail(GTK_IS_LEVEL_BAR(pbar), 0); +- return pbar->priv->bar_height; +-} +- +-void gtk_level_bar_set_value_type(GtkLevelBar *pbar, enum BAR_VALUE bar_value) { +- // Set BAR_VALUE +- g_return_if_fail(GTK_IS_LEVEL_BAR(pbar)); +- GtkLevelBarPrivate* priv = pbar->priv; +- priv->bar_value = bar_value; +- // Redraw +- gtk_level_bar_real_update(pbar); +-} +- +-enum BAR_VALUE gtk_level_bar_get_scale(GtkLevelBar *pbar) { +- // Get BAR_VALUE +- g_return_val_if_fail(GTK_IS_LEVEL_BAR(pbar), VALUE_NONE); +- GtkLevelBarPrivate* priv = pbar->priv; +- return priv->bar_value; +-} +- +-void gtk_level_bar_set_shape(GtkLevelBar *pbar, enum BAR_SHAPE bar_shape) { +- // Set BAR_SHAPE +- g_return_if_fail(GTK_IS_LEVEL_BAR(pbar)); +- GtkLevelBarPrivate* priv = pbar->priv; +- priv->bar_shape = bar_shape; +- // Redraw +- gtk_level_bar_real_update(pbar); +-} +- +-enum BAR_SHAPE gtk_level_bar_get_shape(GtkLevelBar *pbar) { +- // Get BAR_SHAPE +- g_return_val_if_fail(GTK_IS_LEVEL_BAR(pbar), SHAPE_LEVELBAR); +- GtkLevelBarPrivate* priv = pbar->priv; +- return priv->bar_shape; +-} +- +- +Index: src/gtklevelbar.h +=================================================================== +--- src/gtklevelbar.h ++++ /dev/null +@@ -1,60 +0,0 @@ +-#ifndef __GTK_LEVEL_BAR_H__ +-#define __GTK_LEVEL_BAR_H__ +- +-// A simple level bar widget. +- +-#include +- +-typedef enum BAR_VALUE {VALUE_NONE, VALUE_0_1/*0 - 1.0*/, VALUE_PERCENT/*0 - 100%*/} BAR_VALUE; +-typedef enum BAR_SHAPE {SHAPE_LEVELBAR, SHAPE_LINE, SHAPE_LINE2, SHAPE_CIRCLE} BAR_SHAPE; +- +-G_BEGIN_DECLS +- +-#define GTK_TYPE_LEVEL_BAR (gtk_level_bar_get_type ()) +-#define GTK_LEVEL_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LEVEL_BAR, GtkLevelBar)) +-#define GTK_LEVEL_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LEVEL_BAR, GtkLevelBarClass)) +-#define GTK_IS_LEVEL_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LEVEL_BAR)) +-#define GTK_IS_LEVEL_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LEVEL_BAR)) +-#define GTK_LEVEL_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LEVEL_BAR, GtkLevelBarClass)) +- +-typedef struct _GtkLevelBar GtkLevelBar; +-typedef struct _GtkLevelBarPrivate GtkLevelBarPrivate; +-typedef struct _GtkLevelBarClass GtkLevelBarClass; +- +-struct _GtkLevelBar { +- GtkWidget parent; +- +- /*< private >*/ +- GtkLevelBarPrivate *priv; +-}; +- +-struct _GtkLevelBarClass { +- GtkWidgetClass parent_class; +- +- /* Padding for future expansion */ +- void (*_gtk_reserved1) (void); +- void (*_gtk_reserved2) (void); +- void (*_gtk_reserved3) (void); +- void (*_gtk_reserved4) (void); +-}; +- +-GType gtk_level_bar_get_type(void) G_GNUC_CONST; +-GtkWidget* gtk_level_bar_new(void); +- +-void gtk_level_bar_set_bar_height(GtkLevelBar *pbar, guint height); +-void gtk_level_bar_set_fraction(GtkLevelBar *pbar, gdouble fraction); +- +-guint gtk_level_bar_get_bar_height(GtkLevelBar *pbar); +-gdouble gtk_level_bar_get_fraction(GtkLevelBar *pbar); +- +-void gtk_level_bar_set_value_type(GtkLevelBar *pbar, enum BAR_VALUE bar_value); +-enum BAR_VALUE gtk_level_bar_get_value_type(GtkLevelBar *pbar); +- +-void gtk_level_bar_set_shape(GtkLevelBar *pbar, enum BAR_SHAPE bar_shape); +-enum BAR_SHAPE gtk_level_bar_get_shape(GtkLevelBar *pbar); +- +-G_END_DECLS +- +-#endif +- +- +Index: src/levelbar.c +=================================================================== +--- /dev/null ++++ src/levelbar.c +@@ -0,0 +1,357 @@ ++/* ++ * Copyright (c) Linux community. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 3 of the License (GPL3), or any later version. ++ * ++ * This library 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 Library General Public License 3 for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License 3 along with this program; if not, see /usr/share/common-licenses/GPL file ++ * or write to Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++*/ ++#include "levelbar.h" ++#include // round() ++ ++// A simple level bar widget. ++// By Osmo Antero. ++// ++// Sample call: ++// GtkWidget *lb = level_bar_new(); ++// gtk_widget_show(lb); ++// ++// Set value [0.0, 1.0]. ++// level_bar_set_fraction(LEVEL_BAR(lb), 0.8); ++// ++// Show %-value [0 - 100%] or plain value [0 - 1.0] on the level bar. See BAR_VALUE enum. ++// level_bar_set_value_type(LEVEL_BAR(lb), VALUE_PRECENT); ++// ++ ++struct _LevelBarPrivate { ++ gdouble fraction; ++ guint bar_height; ++ enum BAR_VALUE bar_value; ++ enum BAR_SHAPE bar_shape; ++}; ++ ++static void level_bar_get_preferred_width(GtkWidget *widget, gint *minimum, gint *natural); ++static void level_bar_get_preferred_height (GtkWidget *widget,gint *minimum, gint *natural); ++ ++static void level_bar_real_update(LevelBar *progress); ++static gboolean level_bar_draw(GtkWidget *widget, cairo_t *cr); ++ ++static void level_bar_finalize(GObject *object); ++ ++G_DEFINE_TYPE(LevelBar, level_bar, GTK_TYPE_WIDGET); ++ ++static void level_bar_class_init(LevelBarClass *class) { ++ GObjectClass *gobject_class; ++ GtkWidgetClass *widget_class; ++ ++ gobject_class = G_OBJECT_CLASS (class); ++ widget_class = (GtkWidgetClass *)class; ++ ++ gobject_class->set_property = NULL; ++ gobject_class->get_property = NULL; ++ gobject_class->finalize = level_bar_finalize; ++ ++ widget_class->draw = level_bar_draw; ++ widget_class->get_preferred_width = level_bar_get_preferred_width; ++ widget_class->get_preferred_height = level_bar_get_preferred_height; ++ ++ g_type_class_add_private(class, sizeof (LevelBarPrivate)); ++} ++ ++static void level_bar_init(LevelBar *pbar) { ++ LevelBarPrivate *priv; ++ ++ pbar->priv = G_TYPE_INSTANCE_GET_PRIVATE(pbar, TYPE_LEVEL_BAR, LevelBarPrivate); ++ priv = pbar->priv; ++ ++ priv->fraction = 0.0; ++ priv->bar_height = 8; ++ priv->bar_value = VALUE_NONE; ++ priv->bar_shape = SHAPE_CIRCLE; // pulsing line with circle at end. ++ ++ gtk_widget_set_has_window(GTK_WIDGET (pbar), FALSE); ++} ++ ++GtkWidget *level_bar_new(void) { ++ GtkWidget *pbar; ++ pbar = g_object_new(TYPE_LEVEL_BAR, NULL); ++ return pbar; ++} ++ ++static void level_bar_real_update (LevelBar *pbar) { ++ GtkWidget *widget; ++ ++ g_return_if_fail (IS_LEVEL_BAR (pbar)); ++ ++ LevelBarPrivate __attribute__ ((unused)) *priv = pbar->priv; ++ ++ widget = GTK_WIDGET(pbar); ++ ++ gtk_widget_queue_draw(widget); ++} ++ ++static void level_bar_finalize (GObject *object) { ++ G_OBJECT_CLASS(level_bar_parent_class)->finalize (object); ++} ++ ++static void level_bar_get_preferred_width (GtkWidget *widget,gint *minimum, gint *natural) { ++ *minimum = 50; ++ *natural = 160; ++} ++ ++static void level_bar_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural) { ++ *minimum = 6; ++ *natural = 8; ++} ++ ++static gboolean level_bar_draw(GtkWidget *widget, cairo_t *cr) { ++ // Draw level bar and optional text ++ LevelBar *pbar = LEVEL_BAR (widget); ++ LevelBarPrivate *priv = pbar->priv; ++ GtkStyleContext *context; ++ int width, height; ++ ++ context = gtk_widget_get_style_context(widget); ++ ++ width = gtk_widget_get_allocated_width(widget); ++ height = gtk_widget_get_allocated_height(widget); ++ ++ // Bar thickness ++ gdouble bar_height = MIN(height , priv->bar_height); ++ ++ // Vertical pos ++ gdouble y = (height - bar_height)/2; ++ ++ // Pulse width ++ gdouble w = priv->fraction/(1.00/width); ++ ++ // Debug: ++ // LOG_DEBUG("width=%d height=%d bar_height=%2.1f y=%2.1f w=%2.1f fraction=%2.1f\n", width, height, bar_height, y, w, priv->fraction); ++ ++ gtk_style_context_save(context); ++ gtk_render_background(context, cr, 0, 0, width, height); ++ gtk_render_frame(context, cr, 0, 0, width, height); ++ ++ // Render level bar with current theme and color. ++ ++ // Progressbar style ++ gtk_style_context_add_class(context, GTK_STYLE_CLASS_PROGRESSBAR); ++ ++ if (priv->fraction > 0.001) { ++ ++ switch (priv->bar_shape) { ++ ++ case SHAPE_LINE: ++ // Render a single line ++ if (priv->bar_value == VALUE_NONE) { ++ // No value (text) shown. Draw a line on the middle. ++ gtk_render_line(context, cr, 0, y + (bar_height / 2), w, y + (bar_height / 2)); ++ ++ } else { ++ // Draw a line under text. ++ gtk_render_line(context, cr, 0, y + (bar_height ), w, y + (bar_height )); ++ } ++ ++ break; ++ ++ case SHAPE_LINE2: ++ // Render two horizontal lines + close the end. ++ gtk_render_line(context, cr, 0, y-1 , w, y-1); ++ gtk_render_line(context, cr, 0, y + (bar_height ), w, y + (bar_height )); ++ gtk_render_line(context, cr, w, y - 1, w, y + (bar_height )); ++ break; ++ ++ case SHAPE_CIRCLE: ++ // Draw a line on the middle + circle at the end. ++ gtk_render_line(context, cr, 0, y + (bar_height / 2), w, y + (bar_height / 2)); ++ gtk_render_option(context, cr, w, y, bar_height+1, bar_height+1); ++ break; ++ ++ default: ++ // case SHAPE_LEVELBAR: ++ ++ // EDIT: gtk_render_activity() does not work in GTK 3.14+ ++ // gtk_style_context_set_state(context, GTK_STATE_FLAG_ACTIVE); ++ // gtk_render_activity(context, cr, 0, y, w, bar_height); ++ ++ // Render a filled frame (this is a typical levelbar). ++ gtk_render_frame(context, cr, 0, y, w, bar_height); ++ break; ++ ++ } ++ } ++ ++ gtk_style_context_restore(context); ++ ++ cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); ++ cairo_set_font_size(cr, priv->bar_height); ++ ++ GdkRGBA color; ++ gtk_style_context_get_border_color(context, GTK_STATE_NORMAL, &color); ++ gdk_cairo_set_source_rgba(cr, &color); ++ color.alpha = 0.9; ++ ++ // Calculate total width of scale ++ cairo_text_extents_t extents; ++ cairo_text_extents(cr, "0.0", &extents); ++ gint total_w = 9 * (extents.x_advance + extents.width); ++ ++ // Debug: ++ // g_print("Bar width=%d total_w=%d bearing=%3.1f advance=%3.1f char.width=%3.1f\n", width, total_w, ++ // extents.x_bearing, extents.x_advance, extents.width); ++ ++ // Draw values ++ gboolean draw_all = (total_w - extents.width) < width; ++ ++ // Show normalized value [0 - 1.0]? ++ if (priv->bar_value == VALUE_0_1) { ++ // Value: 0.1 0.2 0.3 0.4...0.9 ++ ++ gint i = 0; ++ for (i=0; i < 10; i++) { ++ gchar *s = NULL; ++ ++ // Draw all or draw only each second value? ++ if (draw_all || (i % 2 == 0)) ++ s = g_strdup_printf("%2.1f", (gdouble)i/10.0); ++ ++ if (!s) continue; ++ ++ cairo_text_extents_t extents; ++ cairo_text_extents(cr, s, &extents); ++ ++ gdouble xx = (width/10) * i; ++ gdouble yy = (height/2)-(extents.height/2 + extents.y_bearing) + 0.2; ++ ++ cairo_move_to(cr, xx, yy); ++ cairo_show_text(cr, s); ++ ++ g_free(s); ++ } ++ ++ // Show percentage value? ++ } else if (priv->bar_value == VALUE_PERCENT) { ++ // Value: 10% . 20% . 30% . 40% . 50% ... 90% ++ gint i = 0; ++ for (i=0; i < 10; i++) { ++ gchar *s = NULL; ++ if (i % 2 == 0) ++ s = g_strdup_printf("%2.0f%%", (gdouble)i*10.0); ++ else ++ s = g_strdup_printf("%3s", "."); ++ ++ cairo_text_extents_t extents; ++ cairo_text_extents(cr, s, &extents); ++ ++ gdouble xx = (width/10) * i; ++ gdouble yy = (height/2)-(extents.height/2 + extents.y_bearing); ++ ++ cairo_move_to(cr, xx, yy); ++ cairo_show_text(cr, s); ++ ++ g_free(s); ++ } ++ } ++ ++#if 0 ++ // Commented out by moma 30.sep.2012. ++ ++ // Set text ++ if (priv->text) { ++ cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); ++ ++ cairo_set_font_size(cr, 0.5*height); ++ cairo_text_extents_t extents; ++ cairo_text_extents(cr, priv->text, &extents); ++ ++ // Ref: http://cairographics.org/manual/cairo-cairo-scaled-font-t.html#cairo-text-extents-t ++ gdouble xx = width-(extents.width + extents.x_bearing)-2; ++ gdouble yy = height/2-(extents.height/2 + extents.y_bearing); ++ ++ GdkRGBA color; ++ gtk_style_context_get_border_color(context, GTK_STATE_NORMAL, &color); ++ gdk_cairo_set_source_rgba(cr, &color); ++ color.alpha = 0.9; ++ ++ cairo_move_to(cr, xx, yy); ++ cairo_show_text(cr, priv->text); ++ } ++#endif ++ ++ return FALSE; ++} ++ ++void level_bar_set_fraction(LevelBar *pbar, gdouble fraction) { ++ // Set fraction [0.0, 1.0] ++ LevelBarPrivate* priv; ++ g_return_if_fail (IS_LEVEL_BAR (pbar)); ++ priv = pbar->priv; ++ ++ priv->fraction = CLAMP(fraction, 0.0, 1.0); ++ level_bar_real_update (pbar); ++} ++ ++gdouble level_bar_get_fraction(LevelBar *pbar) { ++ // Get fraction ++ g_return_val_if_fail(IS_LEVEL_BAR (pbar), 0); ++ return pbar->priv->fraction; ++} ++ ++void level_bar_set_bar_height(LevelBar *pbar, guint height) { ++ // Set bar height (thickness). Normally 8 pixels. ++ g_return_if_fail(IS_LEVEL_BAR (pbar)); ++ LevelBarPrivate* priv = pbar->priv; ++ priv->bar_height = height; ++ // Redraw ++ level_bar_real_update(pbar); ++} ++ ++guint level_bar_get_bar_height(LevelBar *pbar) { ++ // Get bar thickness ++ g_return_val_if_fail(IS_LEVEL_BAR(pbar), 0); ++ return pbar->priv->bar_height; ++} ++ ++void level_bar_set_value_type(LevelBar *pbar, enum BAR_VALUE bar_value) { ++ // Set BAR_VALUE ++ g_return_if_fail(IS_LEVEL_BAR(pbar)); ++ LevelBarPrivate* priv = pbar->priv; ++ priv->bar_value = bar_value; ++ // Redraw ++ level_bar_real_update(pbar); ++} ++ ++enum BAR_VALUE level_bar_get_scale(LevelBar *pbar) { ++ // Get BAR_VALUE ++ g_return_val_if_fail(IS_LEVEL_BAR(pbar), VALUE_NONE); ++ LevelBarPrivate* priv = pbar->priv; ++ return priv->bar_value; ++} ++ ++void level_bar_set_shape(LevelBar *pbar, enum BAR_SHAPE bar_shape) { ++ // Set BAR_SHAPE ++ g_return_if_fail(IS_LEVEL_BAR(pbar)); ++ LevelBarPrivate* priv = pbar->priv; ++ priv->bar_shape = bar_shape; ++ // Redraw ++ level_bar_real_update(pbar); ++} ++ ++enum BAR_SHAPE level_bar_get_shape(LevelBar *pbar) { ++ // Get BAR_SHAPE ++ g_return_val_if_fail(IS_LEVEL_BAR(pbar), SHAPE_LEVELBAR); ++ LevelBarPrivate* priv = pbar->priv; ++ return priv->bar_shape; ++} ++ ++ +Index: src/levelbar.h +=================================================================== +--- /dev/null ++++ src/levelbar.h +@@ -0,0 +1,60 @@ ++#ifndef __LEVEL_BAR_H__ ++#define __LEVEL_BAR_H__ ++ ++// A simple level bar widget. ++ ++#include ++ ++typedef enum BAR_VALUE {VALUE_NONE, VALUE_0_1/*0 - 1.0*/, VALUE_PERCENT/*0 - 100%*/} BAR_VALUE; ++typedef enum BAR_SHAPE {SHAPE_LEVELBAR, SHAPE_LINE, SHAPE_LINE2, SHAPE_CIRCLE} BAR_SHAPE; ++ ++G_BEGIN_DECLS ++ ++#define TYPE_LEVEL_BAR (level_bar_get_type ()) ++#define LEVEL_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_LEVEL_BAR, LevelBar)) ++#define LEVEL_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_LEVEL_BAR, LevelBarClass)) ++#define IS_LEVEL_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_LEVEL_BAR)) ++#define IS_LEVEL_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_LEVEL_BAR)) ++#define LEVEL_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_LEVEL_BAR, LevelBarClass)) ++ ++typedef struct _LevelBar LevelBar; ++typedef struct _LevelBarPrivate LevelBarPrivate; ++typedef struct _LevelBarClass LevelBarClass; ++ ++struct _LevelBar { ++ GtkWidget parent; ++ ++ /*< private >*/ ++ LevelBarPrivate *priv; ++}; ++ ++struct _LevelBarClass { ++ GtkWidgetClass parent_class; ++ ++ /* Padding for future expansion */ ++ void (*_gtk_reserved1) (void); ++ void (*_gtk_reserved2) (void); ++ void (*_gtk_reserved3) (void); ++ void (*_gtk_reserved4) (void); ++}; ++ ++GType level_bar_get_type(void) G_GNUC_CONST; ++GtkWidget* level_bar_new(void); ++ ++void level_bar_set_bar_height(LevelBar *pbar, guint height); ++void level_bar_set_fraction(LevelBar *pbar, gdouble fraction); ++ ++guint level_bar_get_bar_height(LevelBar *pbar); ++gdouble level_bar_get_fraction(LevelBar *pbar); ++ ++void level_bar_set_value_type(LevelBar *pbar, enum BAR_VALUE bar_value); ++enum BAR_VALUE level_bar_get_value_type(LevelBar *pbar); ++ ++void level_bar_set_shape(LevelBar *pbar, enum BAR_SHAPE bar_shape); ++enum BAR_SHAPE level_bar_get_shape(LevelBar *pbar); ++ ++G_END_DECLS ++ ++#endif ++ ++ +Index: src/main.c +=================================================================== +--- src/main.c.orig ++++ src/main.c +@@ -25,7 +25,7 @@ + + #include + +-#include "gtklevelbar.h" // Level bar widget ++#include "levelbar.h" // Level bar widget + #include "support.h" + #include "audio-sources.h" + #include "rec-window.h" +@@ -274,13 +274,13 @@ void win_set_filename(gchar *filename) { + } + + void win_update_level_bar(gdouble norm_rms, gdouble norm_peak) { +- // Set pulse on gtklevelbar ++ // Set pulse on the levelbar + +- if (!GTK_IS_LEVEL_BAR(g_win.level_bar)) return; ++ if (!IS_LEVEL_BAR(g_win.level_bar)) return; + + // Show either RMS or peak-value on the levelbar. + // Notice: This value has no GUI-setting. User must change it in the dconf-editor. +- gtk_level_bar_set_fraction(GTK_LEVEL_BAR(g_win.level_bar), ++ level_bar_set_fraction(LEVEL_BAR(g_win.level_bar), + (g_win.pulse_type == PULSE_RMS ? norm_rms : norm_peak)); + } + +@@ -810,7 +810,7 @@ void win_show_settings_dialog() { + + void win_level_bar_clicked(GtkWidget *widget, GdkEvent *event, gpointer data) { + // User clicked on the level bar. +- // Set BAR_VALUE or BAR_SHAPE. See gtklevelbar.h.value ++ // Set BAR_VALUE or BAR_SHAPE. See levelbar.h. + GdkEventButton *ev = (GdkEventButton*)event; + + if (ev->button == 1) { +@@ -827,7 +827,7 @@ void win_level_bar_clicked(GtkWidget *wi + } + + // Update GUI +- gtk_level_bar_set_value_type(GTK_LEVEL_BAR(g_win.level_bar), bar_value); ++ level_bar_set_value_type(LEVEL_BAR(g_win.level_bar), bar_value); + + // Save in DConf + conf_save_int_value("level-bar-value", bar_value); +@@ -846,7 +846,7 @@ void win_level_bar_clicked(GtkWidget *wi + } + + // Update GUI +- gtk_level_bar_set_shape(GTK_LEVEL_BAR(g_win.level_bar), bar_shape); ++ level_bar_set_shape(LEVEL_BAR(g_win.level_bar), bar_shape); + + // Save in DConf + conf_save_int_value("level-bar-shape", bar_shape); +@@ -981,7 +981,7 @@ void win_create_window() { + } + } + +- // Gtklevelbar/pulsebar: Indicator for sound amplitude (a GtkLevelBar widget). ++ // Levelbar/pulsebar: Indicator for sound amplitude. + // Put it in a GtkEventBox so we can catch click events. + + GtkWidget *event_box = gtk_event_box_new(); +@@ -992,24 +992,24 @@ void win_create_window() { + gtk_widget_set_events(event_box, GDK_BUTTON_PRESS_MASK); + g_signal_connect(event_box, "button_press_event", G_CALLBACK(win_level_bar_clicked), NULL); + +- // Create GtkLevelBar widget and put it in the GtkEventBox +- g_win.level_bar = gtk_level_bar_new(); ++ // Create a LevelBar widget and put it in the GtkEventBox ++ g_win.level_bar = level_bar_new(); + gtk_widget_show(g_win.level_bar); + gtk_container_add(GTK_CONTAINER(event_box), g_win.level_bar); +- gtk_level_bar_set_fraction(GTK_LEVEL_BAR(g_win.level_bar), 0.0); ++ level_bar_set_fraction(LEVEL_BAR(g_win.level_bar), 0.0); + + // How to draw the level bar? + // Get from DConf + gint bar_shape = SHAPE_CIRCLE; + conf_get_int_value("level-bar-shape", &bar_shape); +- gtk_level_bar_set_shape(GTK_LEVEL_BAR(g_win.level_bar), bar_shape); ++ level_bar_set_shape(LEVEL_BAR(g_win.level_bar), bar_shape); + // Notice: User can change this by RIGHT-clicking on the level-bar + + // Type of value on the level bar? + // Get from DConf + gint bar_value = VALUE_NONE; + conf_get_int_value("level-bar-value", &bar_value); +- gtk_level_bar_set_value_type(GTK_LEVEL_BAR(g_win.level_bar), bar_value); ++ level_bar_set_value_type(LEVEL_BAR(g_win.level_bar), bar_value); + // Notice: User can change this by LEFT-clicking on the level-bar + + // Should we show RMS or peak-value on the levelbar? +Index: src/rec-window.h +=================================================================== +--- src/rec-window.h.orig ++++ src/rec-window.h +@@ -5,12 +5,12 @@ + #include + #include + +-#include "gtklevelbar.h" ++#include "levelbar.h" + + // Width of the settings window + #define PREF_WINDOW_WIDTH 300 + +-// PULSE_TYPE: Type of pulse on the gtklevelbar. ++// PULSE_TYPE: Type of pulse on the levelbar. + // Notice: This cannot be changed from the GUI. + // Use Gsettings/dconf-editor and find "level-bar-pulse-type" in apps -> audio-recorder. + typedef enum PULSE_TYPE {PULSE_PEAK, PULSE_RMS} PULSE_TYPE; +Index: src/settings.c +=================================================================== +--- src/settings.c.orig ++++ src/settings.c +@@ -354,7 +354,7 @@ static void player_view_fill() { + case COMM_PROGRAM: + descr = g_strdup(item->description); + +- pixbuf = load_icon_pixbuf(item->icon_name); ++ pixbuf = load_icon_pixbuf(item->icon_name, 22); + + // Translators: This is a label/help text in the [Additional settings] dialog + help_text = g_strdup(_("Select both output device (speakers) and webcam/microphone.")); +Index: src/systray-icon.c +=================================================================== +--- src/systray-icon.c.orig ++++ src/systray-icon.c +@@ -101,7 +101,7 @@ void systray_set_menu_items2(gboolean sh + static void systray_popup_menu_cb(GtkWidget * widget, gpointer data) { + gchar *cmd = (gchar*)data; + +- LOG_SYSTRAY("%s: systray_popup_menu_cb: %s\n", INSTALLED_INDICATOR_TYPE, cmd); ++ LOG_SYSTRAY("systray_popup_menu_cb: %s\n", cmd); + + if (!g_strcmp0(cmd, "start")) { + rec_manager_flip_recording(); +Index: src/utility.c +=================================================================== +--- src/utility.c.orig ++++ src/utility.c +@@ -923,7 +923,7 @@ LBL_1: + return value; + } + +-GdkPixbuf *load_icon_pixbuf(gchar *icon_name) { ++GdkPixbuf *load_icon_pixbuf(gchar *icon_name, guint _size) { + // Load icon pixbuf from current icon theme. + GdkPixbuf *pixbuf = NULL; + +@@ -935,11 +935,11 @@ GdkPixbuf *load_icon_pixbuf(gchar *icon_ + GtkIconTheme *theme = gtk_icon_theme_get_default(); + + // Load icon from its theme +- pixbuf = gtk_icon_theme_load_icon(theme, icon_name, 22, 0, NULL); ++ pixbuf = gtk_icon_theme_load_icon(theme, icon_name, _size, 0, NULL); + + // Got it? + if (GDK_IS_PIXBUF(pixbuf)) { +- return pixbuf; ++ goto LBL_1; + } + + // Executable name != icon_name. +@@ -969,13 +969,22 @@ GdkPixbuf *load_icon_pixbuf(gchar *icon_ + + if (icon_n) { + // Load icon +- pixbuf = gtk_icon_theme_load_icon(theme, icon_n, 22, 0, NULL); ++ pixbuf = gtk_icon_theme_load_icon(theme, icon_n, _size, 0, NULL); + } + + g_free(icon_n); + g_free(desktop_file); + g_object_unref(app_info); + ++LBL_1: ++ ++ // Some icons are large. Force to _size. ++ if (GDK_IS_PIXBUF(pixbuf)) { ++ GdkPixbuf *img = gdk_pixbuf_scale_simple(pixbuf, _size, _size, GDK_INTERP_HYPER); ++ g_object_unref(pixbuf); ++ pixbuf = img; ++ } ++ + // Caller should g_object_unref() this value + return pixbuf; + } +Index: src/utility.h +=================================================================== +--- src/utility.h.orig ++++ src/utility.h +@@ -74,7 +74,7 @@ void str_list_print(gchar *prefix, GList + gboolean str_lists_equal(GList *l1, GList *l2); + + gchar *read_value_from_keyfile(gchar *key_file, gchar *group_name, gchar *key_name); +-GdkPixbuf *load_icon_pixbuf(gchar *icon_name); ++GdkPixbuf *load_icon_pixbuf(gchar *icon_name, guint _size); + + void kill_frozen_instances(gchar *program_path, GPid preserve_pid); + void kill_program_by_name(gchar *app_name, GPid preserve_pid); diff --git a/audio-recorder.changes b/audio-recorder.changes index 1ee47d5..92793de 100644 --- a/audio-recorder.changes +++ b/audio-recorder.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Tue May 5 14:48:03 UTC 2015 - dimstar@opensuse.org + +- Update to version 1.6-2: + + See ChangeLog for full details. +- Add pkgconfig(gstreamer-pbutils-1.0) and + pkgconfig(appindicator3-0.1) BuildRequires: new dependecies. +- Add audio-recorder-gtk-3.16.patch: Add GTK 3.16 compatibility. +- Drop audio-recorder-automake.patch: fixed upstream. + ------------------------------------------------------------------- Thu Oct 9 13:19:09 UTC 2014 - dimstar@opensuse.org diff --git a/audio-recorder.spec b/audio-recorder.spec index 978d10e..1686046 100644 --- a/audio-recorder.spec +++ b/audio-recorder.spec @@ -1,7 +1,7 @@ # # spec file for package audio-recorder # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,18 +17,18 @@ Name: audio-recorder -Version: 1.4 +Version: 1.6 Release: 0 -%define real_version 1.4-1 +%define real_version 1.6-2 Summary: An audio recorder application for the GNOME 2/3 License: GPL-3.0 Group: Productivity/Multimedia/Sound/Utilities Url: https://launchpad.net/audio-recorder -Source: https://launchpad.net/audio-recorder/trunk/version1.4-1/+download/audio-recorder-1.4-1.tar.gz +Source: https://launchpad.net/audio-recorder/trunk/version1.6-2/+download/audio-recorder-1.6-2.tar.gz # PATCH-FIX-OPENSUSE audio-recorder-correct-desktop-menu.patch badshah400@gmail.com -- Fixes the .desktop file by removing unity related tags from it. Patch0: audio-recorder-correct-desktop-menu.patch -# PATCH-FIX-UPSTREAM audio-recorder-automake.patch lp#1379339 dimstar@opensuse.org -- Fix the order of commands in configure.ac -Patch1: audio-recorder-automake.patch +# PATCH-FIX-UPSTREAM audio-recorder-gtk-3.16.patch dimstar@opensuse.org -- Introduce GTK 3.16 compatibility, taken from upstream. +Patch1: audio-recorder-gtk-3.16.patch BuildRequires: autoconf BuildRequires: desktop-file-utils BuildRequires: fdupes @@ -36,10 +36,12 @@ BuildRequires: gettext BuildRequires: hicolor-icon-theme BuildRequires: intltool BuildRequires: libtool +BuildRequires: pkgconfig(appindicator3-0.1) >= 0.3 BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dconf) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gstreamer-1.0) +BuildRequires: pkgconfig(gstreamer-pbutils-1.0) >= 1.4 BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(libpulse) Requires: gstreamer-plugins-bad @@ -79,7 +81,7 @@ User can also control the recorder from command line with %prep %setup -q -n %{name} %patch0 -p1 -%patch1 -p1 +%patch1 -p0 %build aclocal && autoconf && automake -a