Unifiying the plugin API
This commit is contained in:
parent
98c2a38df3
commit
176b0599f3
|
@ -39,8 +39,8 @@ typedef struct _PanelAppletHelper
|
|||
void (*about_dialog)(Panel * panel);
|
||||
int (*lock)(Panel * panel);
|
||||
void (*logout_dialog)(Panel * panel);
|
||||
void (*position_menu)(GtkMenu * menu, gint * x, gint * y,
|
||||
gboolean * push_in, gpointer data);
|
||||
void (*position_menu)(Panel * panel, GtkMenu * menu, gint * x, gint * y,
|
||||
gboolean * push_in);
|
||||
void (*preferences_dialog)(Panel * panel);
|
||||
void (*shutdown_dialog)(Panel * panel);
|
||||
int (*suspend)(Panel * panel);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Panel */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -227,8 +227,8 @@ static void _on_keyboard_toggled(GtkWidget * widget, gpointer data)
|
|||
_init_idle(keyboard);
|
||||
if(keyboard->window == NULL)
|
||||
return;
|
||||
keyboard->helper->position_menu((GtkMenu*)keyboard->window, &x, &y,
|
||||
&push_in, keyboard->helper->panel);
|
||||
keyboard->helper->position_menu(keyboard->helper->panel,
|
||||
(GtkMenu*)keyboard->window, &x, &y, &push_in);
|
||||
gtk_window_move(GTK_WINDOW(keyboard->window), x, y);
|
||||
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
|
||||
gtk_widget_show(keyboard->window);
|
||||
|
|
|
@ -288,6 +288,9 @@ static void _on_about(gpointer data)
|
|||
|
||||
|
||||
/* on_clicked */
|
||||
static void _clicked_position_menu(GtkMenu * menu, gint * x, gint * y,
|
||||
gboolean * push_in, gpointer data);
|
||||
|
||||
static void _on_clicked(gpointer data)
|
||||
{
|
||||
Main * main = data;
|
||||
|
@ -336,8 +339,16 @@ static void _on_clicked(gpointer data)
|
|||
_on_shutdown), data);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
|
||||
gtk_widget_show_all(menu);
|
||||
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, main->helper->position_menu,
|
||||
main->helper->panel, 0, gtk_get_current_event_time());
|
||||
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, _clicked_position_menu,
|
||||
main, 0, gtk_get_current_event_time());
|
||||
}
|
||||
|
||||
static void _clicked_position_menu(GtkMenu * menu, gint * x, gint * y,
|
||||
gboolean * push_in, gpointer data)
|
||||
{
|
||||
Main * main = data;
|
||||
|
||||
main->helper->position_menu(main->helper->panel, menu, x, y, push_in);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@ typedef struct _PanelPrefs
|
|||
|
||||
# define PANEL_CLIENT_MESSAGE "DEFORAOS_DESKTOP_PANEL_CLIENT"
|
||||
|
||||
# define PANEL_CONFIG_FILE ".panel"
|
||||
|
||||
# define PANEL_ICON_SIZE_DEFAULT "panel-large"
|
||||
# define PANEL_ICON_SIZE_UNSET NULL
|
||||
# define PANEL_ICON_SIZE_SMALL "panel-small"
|
||||
|
|
36
src/panel.c
36
src/panel.c
|
@ -81,8 +81,6 @@ struct _Panel
|
|||
|
||||
|
||||
/* constants */
|
||||
#define PANEL_CONFIG_FILE ".panel"
|
||||
|
||||
static char const * _authors[] =
|
||||
{
|
||||
"Pierre Pronchery <khorben@defora.org>",
|
||||
|
@ -122,12 +120,12 @@ static int _panel_helper_lock(Panel * panel);
|
|||
#ifndef EMBEDDED
|
||||
static void _panel_helper_logout_dialog(Panel * panel);
|
||||
#endif
|
||||
static void _panel_helper_position_menu(GtkMenu * menu, gint * x, gint * y,
|
||||
gboolean * push_in, PanelPosition position, gpointer data);
|
||||
static void _panel_helper_position_menu_bottom(GtkMenu * menu, gint * x,
|
||||
gint * y, gboolean * push_in, gpointer data);
|
||||
static void _panel_helper_position_menu_top(GtkMenu * menu, gint * x, gint * y,
|
||||
gboolean * push_in, gpointer data);
|
||||
static void _panel_helper_position_menu(Panel * panel, GtkMenu * menu, gint * x,
|
||||
gint * y, gboolean * push_in, PanelPosition position);
|
||||
static void _panel_helper_position_menu_bottom(Panel * panel, GtkMenu * menu,
|
||||
gint * x, gint * y, gboolean * push_in);
|
||||
static void _panel_helper_position_menu_top(Panel * panel, GtkMenu * menu,
|
||||
gint * x, gint * y, gboolean * push_in);
|
||||
static void _panel_helper_preferences_dialog(Panel * panel);
|
||||
static void _panel_helper_shutdown_dialog(Panel * panel);
|
||||
static int _panel_helper_suspend(Panel * panel);
|
||||
|
@ -684,6 +682,7 @@ static void _preferences_on_ok(gpointer data)
|
|||
|
||||
/* private */
|
||||
/* functions */
|
||||
/* config_get_filename */
|
||||
static char * _config_get_filename(void)
|
||||
{
|
||||
char const * homedir;
|
||||
|
@ -866,10 +865,9 @@ static void _logout_dialog_on_response(GtkWidget * widget, gint response)
|
|||
|
||||
|
||||
/* panel_helper_position_menu */
|
||||
static void _panel_helper_position_menu(GtkMenu * menu, gint * x, gint * y,
|
||||
gboolean * push_in, PanelPosition position, gpointer data)
|
||||
static void _panel_helper_position_menu(Panel * panel, GtkMenu * menu, gint * x,
|
||||
gint * y, gboolean * push_in, PanelPosition position)
|
||||
{
|
||||
Panel * panel = data;
|
||||
GtkRequisition req;
|
||||
|
||||
gtk_widget_size_request(GTK_WIDGET(menu), &req);
|
||||
|
@ -893,20 +891,20 @@ static void _panel_helper_position_menu(GtkMenu * menu, gint * x, gint * y,
|
|||
|
||||
|
||||
/* panel_helper_position_menu_bottom */
|
||||
static void _panel_helper_position_menu_bottom(GtkMenu * menu, gint * x,
|
||||
gint * y, gboolean * push_in, gpointer data)
|
||||
static void _panel_helper_position_menu_bottom(Panel * panel, GtkMenu * menu,
|
||||
gint * x, gint * y, gboolean * push_in)
|
||||
{
|
||||
_panel_helper_position_menu(menu, x, y, push_in, PANEL_POSITION_BOTTOM,
|
||||
data);
|
||||
_panel_helper_position_menu(panel, menu, x, y, push_in,
|
||||
PANEL_POSITION_BOTTOM);
|
||||
}
|
||||
|
||||
|
||||
/* panel_helper_position_menu_top */
|
||||
static void _panel_helper_position_menu_top(GtkMenu * menu, gint * x, gint * y,
|
||||
gboolean * push_in, gpointer data)
|
||||
static void _panel_helper_position_menu_top(Panel * panel, GtkMenu * menu,
|
||||
gint * x, gint * y, gboolean * push_in)
|
||||
{
|
||||
_panel_helper_position_menu(menu, x, y, push_in, PANEL_POSITION_TOP,
|
||||
data);
|
||||
_panel_helper_position_menu(panel, menu, x, y, push_in,
|
||||
PANEL_POSITION_TOP);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user