mocicon: mostly formatting cleanup
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
82d541698d
commit
7b25f80de6
1 changed files with 71 additions and 68 deletions
47
mocicon.c
47
mocicon.c
|
@ -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,14 +46,15 @@ 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);
|
||||
menu = gtk_menu_new();
|
||||
|
||||
// Create Items
|
||||
// Create Items
|
||||
start_item = gtk_image_menu_item_new_with_label("Start Server");
|
||||
stop_item = gtk_image_menu_item_new_with_label("Stop Server");
|
||||
next_item = gtk_image_menu_item_new_with_label("Next");
|
||||
|
@ -86,24 +87,25 @@ 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)
|
||||
{
|
||||
// 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)
|
||||
|
||||
// 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 ));
|
||||
}
|
||||
|
||||
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.
|
||||
// Idk. needs work.
|
||||
|
||||
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();
|
||||
|
|
Loading…
Reference in a new issue