[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 01/01: Tidy up commented code and minor cpplint issues

noreply at xfce.org noreply at xfce.org
Sat Sep 2 03:39:56 CEST 2017


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-pulseaudio-plugin.

commit 044551c5d1b032e523903c66c4166bf5b9abf8b7
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Fri Sep 1 21:39:49 2017 -0400

    Tidy up commented code and minor cpplint issues
---
 panel-plugin/mprismenuitem.c           |  4 ++--
 panel-plugin/pulseaudio-button.c       | 16 +++++-----------
 panel-plugin/pulseaudio-config.c       |  3 +--
 panel-plugin/pulseaudio-dialog.c       | 11 +++--------
 panel-plugin/pulseaudio-menu.c         |  6 ------
 panel-plugin/pulseaudio-mpris-player.c |  1 -
 panel-plugin/pulseaudio-mpris.c        |  1 -
 panel-plugin/pulseaudio-notify.c       | 10 +++-------
 panel-plugin/pulseaudio-plugin.c       |  6 ++----
 panel-plugin/pulseaudio-volume.c       | 10 +---------
 panel-plugin/scalemenuitem.c           | 10 +++++-----
 11 files changed, 22 insertions(+), 56 deletions(-)

diff --git a/panel-plugin/mprismenuitem.c b/panel-plugin/mprismenuitem.c
index be222ed..61a9ac4 100644
--- a/panel-plugin/mprismenuitem.c
+++ b/panel-plugin/mprismenuitem.c
@@ -1,5 +1,5 @@
 /* -*- c-basic-offset: 2 -*- vi:set ts=2 sts=2 sw=2:
- * * 2017 Sean Davis <bluesabre at xfce.org>
+ * Copyright (c) 2017 Sean Davis <bluesabre at xfce.org>
  *
  * Licensed under the GNU General Public License Version 2
  *
@@ -124,7 +124,7 @@ remove_children (GtkContainer *container)
 
   children = gtk_container_get_children (container);
 
-  for (l=children; l!=NULL; l=l->next)
+  for (l=children; l != NULL; l=l->next)
     gtk_container_remove (container, l->data);
   g_list_free (children);
 }
diff --git a/panel-plugin/pulseaudio-button.c b/panel-plugin/pulseaudio-button.c
index 00d6b13..a6aa811 100644
--- a/panel-plugin/pulseaudio-button.c
+++ b/panel-plugin/pulseaudio-button.c
@@ -130,7 +130,7 @@ pulseaudio_button_init (PulseaudioButton *button)
   gtk_widget_set_can_focus(GTK_WIDGET(button), FALSE);
   gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-  gtk_button_set_use_underline (GTK_BUTTON (button),TRUE);
+  gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
   gtk_widget_set_focus_on_click (GTK_WIDGET (button), FALSE);
   gtk_widget_set_name (GTK_WIDGET (button), "pulseaudio-button");
 
@@ -162,10 +162,6 @@ pulseaudio_button_init (PulseaudioButton *button)
   gtk_widget_show (button->image);
 
   g_object_set (G_OBJECT (button), "has-tooltip", TRUE, NULL);
-
-  //button->align_box = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
-  //gtk_container_add (GTK_CONTAINER (button), button->align_box);
-  //gtk_widget_show (button->align_box);
 }
 
 
@@ -192,7 +188,7 @@ pulseaudio_button_button_press (GtkWidget      *widget,
 {
   PulseaudioButton *button = PULSEAUDIO_BUTTON (widget);
 
-  if(event->button == 1 && button->menu == NULL) /* left button */
+  if (event->button == 1 && button->menu == NULL) /* left button */
     {
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
       button->menu = pulseaudio_menu_new (button->volume, button->config, button->mpris, widget);
@@ -209,7 +205,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
       gtk_menu_popup (GTK_MENU (button->menu),
                       NULL, NULL,
                       xfce_panel_plugin_position_menu, button->plugin,
-                      //NULL, NULL,
                       1,
                       event->time);
 G_GNUC_END_IGNORE_DEPRECATIONS
@@ -217,7 +212,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
       return TRUE;
     }
 
-  if(event->button == 2) /* middle button */
+  if (event->button == 2) /* middle button */
     {
       pulseaudio_volume_toggle_muted (button->volume);
       return TRUE;
@@ -236,15 +231,14 @@ pulseaudio_button_scroll_event (GtkWidget *widget, GdkEventScroll *event)
   gdouble           new_volume;
 
 
-  if (event->direction == 1) // decrease volume
+  if (event->direction == 1)  // decrease volume
     new_volume = volume - volume_step;
-  else if (event->direction == 0) // increase volume
+  else if (event->direction == 0)  // increase volume
     new_volume = MIN (volume + volume_step, MAX (volume, 1.0));
   else
     new_volume = volume;
 
   pulseaudio_volume_set_volume (button->volume, new_volume);
-  //g_debug ("dir: %d %f -> %f", event->direction, volume, new_volume);
 
   return TRUE;
 }
diff --git a/panel-plugin/pulseaudio-config.c b/panel-plugin/pulseaudio-config.c
index dbbffad..92537e6 100644
--- a/panel-plugin/pulseaudio-config.c
+++ b/panel-plugin/pulseaudio-config.c
@@ -33,11 +33,10 @@
 #include <string.h>
 #endif
 
+#include <libxfce4panel/xfce-panel-plugin.h>
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4ui/libxfce4ui.h>
 #include <xfconf/xfconf.h>
-//#include <exo/exo.h>
-#include <libxfce4panel/xfce-panel-plugin.h>
 
 #include "pulseaudio-plugin.h"
 #include "pulseaudio-config.h"
diff --git a/panel-plugin/pulseaudio-dialog.c b/panel-plugin/pulseaudio-dialog.c
index 6277125..d9c1d39 100644
--- a/panel-plugin/pulseaudio-dialog.c
+++ b/panel-plugin/pulseaudio-dialog.c
@@ -36,10 +36,9 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
+#include <libxfce4panel/xfce-panel-plugin.h>
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4ui/libxfce4ui.h>
-//#include <exo/exo.h>
-#include <libxfce4panel/xfce-panel-plugin.h>
 
 #include "pulseaudio-dialog.h"
 #include "pulseaudio-dialog_ui.h"
@@ -47,7 +46,7 @@
 #define PLUGIN_WEBSITE  "http://goodies.xfce.org/projects/panel-plugins/xfce4-pulseaudio-plugin"
 
 #ifdef LIBXFCE4UI_CHECK_VERSION
-#if LIBXFCE4UI_CHECK_VERSION (4,9,0)
+#if LIBXFCE4UI_CHECK_VERSION (4, 9, 0)
 #define HAS_ONLINE_HELP
 #endif
 #endif
@@ -139,8 +138,6 @@ pulseaudio_dialog_run_mixer (PulseaudioDialog *dialog,
       gtk_window_set_title (GTK_WINDOW (message_dialog), _("Error"));
       gtk_dialog_run (GTK_DIALOG (message_dialog));
       gtk_widget_destroy (message_dialog);
-      //xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\"."),
-      //                        pulseaudio_config_get_mixer_command (dialog->config));
       g_error_free (error);
     }
 }
@@ -160,7 +157,6 @@ pulseaudio_dialog_build (PulseaudioDialog *dialog)
   if (gtk_builder_add_from_string (builder, pulseaudio_dialog_ui,
                                    pulseaudio_dialog_ui_length, &error))
     {
-
       dialog->dialog = gtk_builder_get_object (builder, "dialog");
       g_return_if_fail (XFCE_IS_TITLED_DIALOG (dialog->dialog));
 
@@ -217,7 +213,6 @@ pulseaudio_dialog_build (PulseaudioDialog *dialog)
       object = gtk_builder_get_object (builder, "media-player-frame");
       gtk_widget_set_visible (GTK_WIDGET (object), FALSE);
 #endif
-
     }
   else
     {
@@ -240,7 +235,7 @@ pulseaudio_dialog_help_button_clicked (PulseaudioDialog *dialog,
   g_return_if_fail (GTK_IS_BUTTON (button));
   g_return_if_fail (GTK_IS_WINDOW (dialog->dialog));
 
-  /* Doesn't seem to work */
+  /* FIXME: Doesn't seem to work */
   //#ifdef HAS_ONLINE_HELP
   //xfce_dialog_show_help (GTK_WINDOW (dialog->dialog), "xfce4-pulseaudio", "dialog", NULL);
   //#else
diff --git a/panel-plugin/pulseaudio-menu.c b/panel-plugin/pulseaudio-menu.c
index 906e84b..d988f72 100644
--- a/panel-plugin/pulseaudio-menu.c
+++ b/panel-plugin/pulseaudio-menu.c
@@ -142,7 +142,6 @@ pulseaudio_menu_output_range_scroll (GtkWidget        *widget,
 
   new_volume = volume + (1.0 - 2.0 * scroll_event->direction) * volume_step;
   pulseaudio_volume_set_volume (menu->volume, new_volume);
-  //printf ("scroll %d %g %g\n", scroll_event->direction, volume, new_volume);
 }
 
 
@@ -157,7 +156,6 @@ pulseaudio_menu_output_range_value_changed (PulseaudioMenu   *menu,
 
   new_volume = gtk_range_get_value (GTK_RANGE (menu->range_output)) / 100.0;
   pulseaudio_volume_set_volume (menu->volume, new_volume);
-  //printf ("range value changed %g\n", new_volume);
 }
 
 
@@ -191,7 +189,6 @@ pulseaudio_menu_input_range_scroll (GtkWidget        *widget,
 
   new_volume_mic = volume_mic + (1.0 - 2.0 * scroll_event->direction) * volume_step;
   pulseaudio_volume_set_volume_mic (menu->volume, new_volume_mic);
-  //printf ("scroll %d %g %g\n", scroll_event->direction, volume, new_volume_mic);
 }
 
 
@@ -206,7 +203,6 @@ pulseaudio_menu_input_range_value_changed (PulseaudioMenu   *menu,
 
   new_volume_mic = gtk_range_get_value (GTK_RANGE (menu->range_input)) / 100.0;
   pulseaudio_volume_set_volume_mic (menu->volume, new_volume_mic);
-  //printf ("range value changed %g\n", new_volume_mic);
 }
 
 
@@ -245,8 +241,6 @@ pulseaudio_menu_run_audio_mixer (PulseaudioMenu   *menu,
       gtk_window_set_title (GTK_WINDOW (message_dialog), _("Error"));
       gtk_dialog_run (GTK_DIALOG (message_dialog));
       gtk_widget_destroy (message_dialog);
-      //xfce_dialog_show_error (NULL, error, _("Failed to execute command \"%s\"."),
-      //                        pulseaudio_config_get_mixer_command (menu->config));
       g_error_free (error);
     }
 }
diff --git a/panel-plugin/pulseaudio-mpris-player.c b/panel-plugin/pulseaudio-mpris-player.c
index 199f78c..4227dff 100644
--- a/panel-plugin/pulseaudio-mpris-player.c
+++ b/panel-plugin/pulseaudio-mpris-player.c
@@ -612,7 +612,6 @@ pulseaudio_mpris_player_get_icon_name (PulseaudioMprisPlayer *player)
 const gchar *
 pulseaudio_mpris_player_get_title (PulseaudioMprisPlayer *player)
 {
-
   return player->title;
 }
 
diff --git a/panel-plugin/pulseaudio-mpris.c b/panel-plugin/pulseaudio-mpris.c
index 7a543fb..658ac5f 100644
--- a/panel-plugin/pulseaudio-mpris.c
+++ b/panel-plugin/pulseaudio-mpris.c
@@ -75,7 +75,6 @@ pulseaudio_mpris_class_init (PulseaudioMprisClass *klass)
                     NULL, NULL,
                     g_cclosure_marshal_VOID__STRING,
                     G_TYPE_NONE, 1, G_TYPE_STRING);
-
 }
 
 
diff --git a/panel-plugin/pulseaudio-notify.c b/panel-plugin/pulseaudio-notify.c
index 31345e8..d233373 100644
--- a/panel-plugin/pulseaudio-notify.c
+++ b/panel-plugin/pulseaudio-notify.c
@@ -122,7 +122,6 @@ pulseaudio_notify_init (PulseaudioNotify *notify)
   notify->volume_changed_id = 0;
   notify->volume_mic_changed_id = 0;
 
-  //g_set_application_name ("Xfce volume control");
   notify_init ("Xfce volume control");
 
   caps_list = notify_get_server_caps ();
@@ -132,9 +131,6 @@ pulseaudio_notify_init (PulseaudioNotify *notify)
       node = g_list_find_custom (caps_list, LAYOUT_ICON_ONLY, (GCompareFunc) g_strcmp0);
       if (!node)
         notify->gauge_notifications = FALSE;
-      /*		node = g_list_find_custom (caps_list, SYNCHRONOUS, (GCompareFunc) g_strcmp0);*/
-      /*		if (!node)*/
-      /*			Inst->gauge_notifications = FALSE;*/
       g_list_free (caps_list);
     }
   notify->notification = notify_notification_new ("xfce4-pulseaudio-plugin", NULL, NULL);
@@ -197,11 +193,11 @@ pulseaudio_notify_notify (PulseaudioNotify *notify, gboolean mic)
     volume_i = 0;
 
   if (!connected)
-    title = g_strdup_printf ( _("Not connected to the PulseAudio server"));
+    title = g_strdup_printf (_("Not connected to the PulseAudio server"));
   else if (muted)
-    title = g_strdup_printf ( _("Volume %d%c (muted)"), volume_i, '%');
+    title = g_strdup_printf (_("Volume %d%c (muted)"), volume_i, '%');
   else
-    title = g_strdup_printf ( _("Volume %d%c"), volume_i, '%');
+    title = g_strdup_printf (_("Volume %d%c"), volume_i, '%');
 
   if (!connected)
     icon = icons_array[V_MUTED];
diff --git a/panel-plugin/pulseaudio-plugin.c b/panel-plugin/pulseaudio-plugin.c
index 4e3df87..b23043a 100644
--- a/panel-plugin/pulseaudio-plugin.c
+++ b/panel-plugin/pulseaudio-plugin.c
@@ -252,7 +252,7 @@ pulseaudio_plugin_size_changed (XfcePanelPlugin *plugin,
 {
   PulseaudioPlugin *pulseaudio_plugin = PULSEAUDIO_PLUGIN (plugin);
   gint              icon_size;
-#if !LIBXFCE4PANEL_CHECK_VERSION (4,13,0)
+#if !LIBXFCE4PANEL_CHECK_VERSION (4, 13, 0)
   GtkStyleContext  *context;
   GtkBorder         padding;
   GtkBorder         border;
@@ -263,7 +263,7 @@ pulseaudio_plugin_size_changed (XfcePanelPlugin *plugin,
 
   /* The plugin only occupies a single row */
   size /= xfce_panel_plugin_get_nrows (plugin);
-#if LIBXFCE4PANEL_CHECK_VERSION (4,13,0)
+#if LIBXFCE4PANEL_CHECK_VERSION (4, 13, 0)
   icon_size = xfce_panel_plugin_get_icon_size (plugin);
 #else
   // fall-back for older panel versions
@@ -441,6 +441,4 @@ pulseaudio_plugin_construct (XfcePanelPlugin *plugin)
 
   gtk_container_add (GTK_CONTAINER (plugin), GTK_WIDGET (pulseaudio_plugin->button));
   gtk_widget_show (GTK_WIDGET (pulseaudio_plugin->button));
-
-
 }
diff --git a/panel-plugin/pulseaudio-volume.c b/panel-plugin/pulseaudio-volume.c
index 196b0e4..02adb66 100644
--- a/panel-plugin/pulseaudio-volume.c
+++ b/panel-plugin/pulseaudio-volume.c
@@ -111,7 +111,6 @@ pulseaudio_volume_class_init (PulseaudioVolumeClass *klass)
                   0, NULL, NULL,
                   g_cclosure_marshal_VOID__BOOLEAN,
                   G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-
 }
 
 
@@ -367,7 +366,6 @@ pulseaudio_volume_connect (PulseaudioVolume *volume)
   err = pa_context_connect (volume->pa_context, NULL, PA_CONTEXT_NOFAIL, NULL);
   if (err < 0)
     g_warning ("pa_context_connect() failed: %s", pa_strerror (err));
-  //g_warning ("pa_context_connect() failed: %s", pa_strerror (pa_context_errno (volume->pa_context)));
 }
 
 
@@ -381,7 +379,7 @@ pulseaudio_volume_reconnect_timeout  (gpointer userdata)
   volume->reconnect_timer_id = 0;
   pulseaudio_volume_connect (volume);
 
-  return FALSE; // stop the timer
+  return FALSE;  // stop the timer
 }
 
 
@@ -591,12 +589,9 @@ pulseaudio_volume_set_volume_cb2 (pa_context         *context,
                                   int                 eol,
                                   void               *userdata)
 {
-  //char st[PA_CVOLUME_SNPRINT_MAX];
-
   PulseaudioVolume *volume = PULSEAUDIO_VOLUME (userdata);
   if (i == NULL) return;
 
-  //pulseaudio_debug ("*** %s", pa_cvolume_snprint (st, sizeof (st), &i->volume));
   pa_cvolume_set ((pa_cvolume *)&i->volume, 1, pulseaudio_volume_d2v (volume, volume->volume));
   pa_context_set_sink_volume_by_index (context, i->index, &i->volume, pulseaudio_volume_sink_volume_changed, volume);
 }
@@ -658,12 +653,9 @@ pulseaudio_volume_set_volume_mic_cb2 (pa_context           *context,
                                       int                   eol,
                                       void                 *userdata)
 {
-  //char st[PA_CVOLUME_SNPRINT_MAX];
-
   PulseaudioVolume *volume = PULSEAUDIO_VOLUME (userdata);
   if (i == NULL) return;
 
-  //pulseaudio_debug ("*** %s", pa_cvolume_snprint (st, sizeof (st), &i->volume));
   pa_cvolume_set ((pa_cvolume *)&i->volume, 1, pulseaudio_volume_d2v (volume, volume->volume_mic));
   pa_context_set_source_volume_by_index (context, i->index, &i->volume, pulseaudio_volume_source_volume_changed, volume);
 }
diff --git a/panel-plugin/scalemenuitem.c b/panel-plugin/scalemenuitem.c
index 9c8d083..a817dd4 100644
--- a/panel-plugin/scalemenuitem.c
+++ b/panel-plugin/scalemenuitem.c
@@ -168,7 +168,7 @@ remove_children (GtkContainer *container)
 
   children = gtk_container_get_children (container);
 
-  for (l=children; l!=NULL; l=l->next)
+  for (l=children; l != NULL; l=l->next)
     gtk_container_remove (container, l->data);
   g_list_free (children);
 }
@@ -188,9 +188,9 @@ update_packing (ScaleMenuItem *self)
 
   TRACE("entering");
 
-  if(priv->hbox)
+  if (priv->hbox)
     remove_children (GTK_CONTAINER (priv->hbox));
-  if(priv->vbox)
+  if (priv->vbox)
   {
     remove_children (GTK_CONTAINER (priv->vbox));
     gtk_container_remove (GTK_CONTAINER (self), priv->vbox);
@@ -501,7 +501,7 @@ scale_menu_item_set_description_label (ScaleMenuItem *menuitem,
     {
       gtk_label_set_markup (GTK_LABEL (priv->description_label), label);
     }
-  else if(label)
+  else if (label)
     {
       /* create label */
       priv->description_label = scale_menu_item_label_new (NULL);
@@ -542,7 +542,7 @@ scale_menu_item_set_percentage_label (ScaleMenuItem *menuitem,
     {
       gtk_label_set_text (GTK_LABEL (priv->percentage_label), label);
     }
-  else if(label)
+  else if (label)
     {
       /* create label */
       priv->percentage_label = scale_menu_item_label_new (label);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list