mocicon: mostly formatting cleanup

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2022-02-07 10:11:11 -05:00
parent 82d541698d
commit 7b25f80de6
Signed by: vbatts
GPG key ID: 10937E57733F1362

View file

@ -17,8 +17,8 @@ GtkWidget *menu, *quit_item, *launch_item, *play_item, *stop_item, *start_item,
static gboolean button_press_cb(GtkStatusIcon *icon, GdkEventButton *ev, gpointer user_data);
static void
send( GtkMenuItem *item, gpointer data) {
send( GtkMenuItem *item, gpointer data)
{
switch(GPOINTER_TO_INT(data)) {
case PTR_START:
g_spawn_command_line_async("mocp --play", NULL);
@ -46,8 +46,9 @@ send( GtkMenuItem *item, gpointer data) {
}
}
static void setup() {
static void
setup()
{
GtkStatusIcon *icon;
icon = gtk_status_icon_new_from_stock(GTK_STOCK_MEDIA_PLAY);
g_signal_connect(icon,"button-press-event", G_CALLBACK(button_press_cb), NULL);
@ -86,25 +87,26 @@ static void setup() {
gtk_menu_shell_append(GTK_MENU_SHELL(menu), quit_item);
// show widgets
gtk_widget_show_all(menu);
};
}
gboolean button_press_cb(GtkStatusIcon *icon, GdkEventButton *ev, gpointer user_data)
gboolean
button_press_cb(GtkStatusIcon *icon, GdkEventButton *ev, gpointer user_data)
{
// I am not entirely sure what to do, double click implementation is possible. say double click to get info. single click just pause/plays. but it will STILL register the first click, so it would pause and then give info.
// I am not entirely sure what to do, double click implementation is
// possible. say double click to get info. single click just
// pause/plays. but it will STILL register the first click, so it would
// pause and then give info.
// Idk. needs work.
{
if(ev->button == 3)
if(ev->button == 3) {
// Popup the menu
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, ev->button, ev->time);
}
if(ev->button == 2) {
send(NULL, GINT_TO_POINTER( PTR_NOTIFY ));
}
if(ev->button == 1) {
send(NULL, GINT_TO_POINTER( PTR_PLAYTOGGLE ));
}
@ -114,7 +116,8 @@ gboolean button_press_cb(GtkStatusIcon *icon, GdkEventButton *ev, gpointer user_
//this whole section really should just be one function with an if/then statement instead of a dozen different little functions
//play or pause
gint main(gint argc, gchar **argv)
gint
main(gint argc, gchar **argv)
{
gtk_init(&argc, &argv);
setup();