Fixed suspending and resuming via plug-in messages
This commit is contained in:
parent
8453eb9d3f
commit
774058a6c2
@ -3273,9 +3273,9 @@ static void _phone_message(Phone * phone, PhoneMessage message, ...)
|
|||||||
case PHONE_MESSAGE_POWER_MANAGEMENT:
|
case PHONE_MESSAGE_POWER_MANAGEMENT:
|
||||||
power = va_arg(ap, PhoneMessagePowerManagement);
|
power = va_arg(ap, PhoneMessagePowerManagement);
|
||||||
if(power == PHONE_MESSAGE_POWER_MANAGEMENT_RESUME)
|
if(power == PHONE_MESSAGE_POWER_MANAGEMENT_RESUME)
|
||||||
event.type = PHONE_EVENT_TYPE_SUSPEND;
|
|
||||||
else if(power == PHONE_MESSAGE_POWER_MANAGEMENT_SUSPEND)
|
|
||||||
event.type = PHONE_EVENT_TYPE_RESUME;
|
event.type = PHONE_EVENT_TYPE_RESUME;
|
||||||
|
else if(power == PHONE_MESSAGE_POWER_MANAGEMENT_SUSPEND)
|
||||||
|
event.type = PHONE_EVENT_TYPE_SUSPEND;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
phone_event(phone, &event);
|
phone_event(phone, &event);
|
||||||
|
@ -155,6 +155,8 @@ static void _popup_menu_on_show_dialer(gpointer data);
|
|||||||
static void _popup_menu_on_show_logs(gpointer data);
|
static void _popup_menu_on_show_logs(gpointer data);
|
||||||
static void _popup_menu_on_show_messages(gpointer data);
|
static void _popup_menu_on_show_messages(gpointer data);
|
||||||
static void _popup_menu_on_show_settings(gpointer data);
|
static void _popup_menu_on_show_settings(gpointer data);
|
||||||
|
static void _popup_menu_on_resume(gpointer data);
|
||||||
|
static void _popup_menu_on_suspend(gpointer data);
|
||||||
|
|
||||||
static void _systray_on_popup_menu(GtkStatusIcon * icon, guint button,
|
static void _systray_on_popup_menu(GtkStatusIcon * icon, guint button,
|
||||||
guint time, gpointer data)
|
guint time, gpointer data)
|
||||||
@ -164,6 +166,7 @@ static void _systray_on_popup_menu(GtkStatusIcon * icon, guint button,
|
|||||||
GtkWidget * menuitem;
|
GtkWidget * menuitem;
|
||||||
|
|
||||||
menu = gtk_menu_new();
|
menu = gtk_menu_new();
|
||||||
|
/* show windows */
|
||||||
menuitem = gtk_menu_item_new_with_mnemonic("Show _dialer");
|
menuitem = gtk_menu_item_new_with_mnemonic("Show _dialer");
|
||||||
g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(
|
g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(
|
||||||
_popup_menu_on_show_dialer), plugin);
|
_popup_menu_on_show_dialer), plugin);
|
||||||
@ -180,6 +183,17 @@ static void _systray_on_popup_menu(GtkStatusIcon * icon, guint button,
|
|||||||
g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(
|
g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(
|
||||||
_popup_menu_on_show_settings), plugin);
|
_popup_menu_on_show_settings), plugin);
|
||||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
|
||||||
|
/* suspend and resume */
|
||||||
|
menuitem = gtk_separator_menu_item_new();
|
||||||
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
|
||||||
|
menuitem = gtk_menu_item_new_with_mnemonic("_Resume telephony");
|
||||||
|
g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(
|
||||||
|
_popup_menu_on_resume), plugin);
|
||||||
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
|
||||||
|
menuitem = gtk_menu_item_new_with_mnemonic("S_uspend telephony");
|
||||||
|
g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(
|
||||||
|
_popup_menu_on_suspend), plugin);
|
||||||
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
|
||||||
gtk_widget_show_all(menu);
|
gtk_widget_show_all(menu);
|
||||||
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, time);
|
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, time);
|
||||||
}
|
}
|
||||||
@ -215,4 +229,22 @@ static void _popup_menu_on_show_settings(gpointer data)
|
|||||||
plugin->helper->message(plugin->helper->phone, PHONE_MESSAGE_SHOW,
|
plugin->helper->message(plugin->helper->phone, PHONE_MESSAGE_SHOW,
|
||||||
PHONE_MESSAGE_SHOW_SETTINGS);
|
PHONE_MESSAGE_SHOW_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _popup_menu_on_resume(gpointer data)
|
||||||
|
{
|
||||||
|
PhonePlugin * plugin = data;
|
||||||
|
|
||||||
|
plugin->helper->message(plugin->helper->phone,
|
||||||
|
PHONE_MESSAGE_POWER_MANAGEMENT,
|
||||||
|
PHONE_MESSAGE_POWER_MANAGEMENT_RESUME);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _popup_menu_on_suspend(gpointer data)
|
||||||
|
{
|
||||||
|
PhonePlugin * plugin = data;
|
||||||
|
|
||||||
|
plugin->helper->message(plugin->helper->phone,
|
||||||
|
PHONE_MESSAGE_POWER_MANAGEMENT,
|
||||||
|
PHONE_MESSAGE_POWER_MANAGEMENT_SUSPEND);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user