1 /*- 2 * Copyright (c) 2020 - 2021 Rozhuk Ivan <rozhuk.im@gmail.com> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * Author: Rozhuk Ivan <rozhuk.im@gmail.com> 27 * 28 */ 29 30 31 #ifndef __GTK_MIXER_H__ 32 #define __GTK_MIXER_H__ 33 34 #include <sys/param.h> 35 #include <sys/types.h> 36 #include <inttypes.h> 37 #include <stdio.h> /* snprintf, fprintf */ 38 #include <time.h> 39 #include <string.h> /* bcopy, bzero, memcpy, memmove, memset, strerror... */ 40 #include <stdlib.h> /* malloc, exit */ 41 #include <unistd.h> /* close, write, sysconf */ 42 43 #ifdef HAVE_CONFIG_H 44 #include "config.h" 45 #else 46 #define PACKAGE_NAME "gtk-mixer" 47 #define VERSION "1.0.0" 48 #define PACKAGE_DESCRIPTION "" 49 #define PACKAGE_URL "" 50 #endif 51 52 #define APP_ICON_NAME "multimedia-volume-control" 53 54 #define GETTEXT_PACKAGE PACKAGE_NAME 55 #include <gtk/gtk.h> 56 #include <glib/gi18n-lib.h> 57 58 #include "plugin_api.h" 59 60 #define BORDER_WIDTH 5 61 62 63 const char *volume_stock_from_level(const int is_mic, const int is_enabled, 64 const int level, const char *cur_icon_name); 65 66 GtkWidget *gtk_mixer_window_create(void); 67 gulong gtk_mixer_window_connect_dev_changed(GtkWidget *window, 68 GCallback c_handler, gpointer data); 69 gmp_dev_p gtk_mixer_window_dev_cur_get(GtkWidget *window); 70 void gtk_mixer_window_dev_cur_set(GtkWidget *window, gmp_dev_p dev); 71 void gtk_mixer_window_dev_list_update(GtkWidget *window, gmp_dev_list_p dev_list); 72 void gtk_mixer_window_lines_update(GtkWidget *window); 73 74 GtkWidget *gtk_mixer_devs_combo_create(void); 75 gmp_dev_p gtk_mixer_devs_combo_cur_get(GtkWidget *combo); 76 void gtk_mixer_devs_combo_cur_set(GtkWidget *combo, gmp_dev_p dev); 77 void gtk_mixer_devs_combo_dev_list_set(GtkWidget *combo, gmp_dev_list_p dev_list); 78 void gtk_mixer_devs_combo_update(GtkWidget *combo); 79 80 GtkWidget *gtk_mixer_container_create(void); 81 void gtk_mixer_container_dev_set(GtkWidget *container, gmp_dev_p dev); 82 void gtk_mixer_container_update(GtkWidget *container); 83 84 GtkWidget *gtk_mixer_line_create(gmp_dev_p dev, gmp_dev_line_p dev_line); 85 void gtk_mixer_line_update(GtkWidget *container); 86 87 88 GtkStatusIcon *gtk_mixer_tray_icon_create(void); 89 void gtk_mixer_tray_icon_dev_set(GtkStatusIcon *status_icon, gmp_dev_p dev); 90 void gtk_mixer_tray_icon_update(GtkStatusIcon *status_icon); 91 92 93 #endif /* __GTK_MIXER_H__ */ 94