make code to show a prompt when you just want to display and message and not do anything when the user presses the button
This commit is contained in:
parent
ffaac4a650
commit
b8960827b7
3 changed files with 28 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
static GList *prompt_list = NULL;
|
static GList *prompt_list = NULL;
|
||||||
|
static GList *prompt_msg_list = NULL;
|
||||||
|
|
||||||
/* we construct these */
|
/* we construct these */
|
||||||
static RrAppearance *prompt_a_bg;
|
static RrAppearance *prompt_a_bg;
|
||||||
|
@ -121,6 +122,9 @@ void prompt_startup(gboolean reconfig)
|
||||||
|
|
||||||
void prompt_shutdown(gboolean reconfig)
|
void prompt_shutdown(gboolean reconfig)
|
||||||
{
|
{
|
||||||
|
while (prompt_msg_list)
|
||||||
|
prompt_cancel(prompt_msg_list->data);
|
||||||
|
|
||||||
RrAppearanceFree(prompt_a_button);
|
RrAppearanceFree(prompt_a_button);
|
||||||
RrAppearanceFree(prompt_a_focus);
|
RrAppearanceFree(prompt_a_focus);
|
||||||
RrAppearanceFree(prompt_a_press);
|
RrAppearanceFree(prompt_a_press);
|
||||||
|
@ -218,6 +222,9 @@ void prompt_unref(ObPrompt *self)
|
||||||
if (self && --self->ref == 0) {
|
if (self && --self->ref == 0) {
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
if (self->mapped)
|
||||||
|
prompt_hide(self);
|
||||||
|
|
||||||
prompt_list = g_list_remove(prompt_list, self);
|
prompt_list = g_list_remove(prompt_list, self);
|
||||||
|
|
||||||
for (i = 0; i < self->n_buttons; ++i) {
|
for (i = 0; i < self->n_buttons; ++i) {
|
||||||
|
@ -600,3 +607,21 @@ void prompt_cancel(ObPrompt *self)
|
||||||
if (self->func) self->func(self, self->cancel_result, self->data);
|
if (self->func) self->func(self, self->cancel_result, self->data);
|
||||||
prompt_hide(self);
|
prompt_hide(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void prompt_show_message_cb(ObPrompt *p, int res, gpointer data)
|
||||||
|
{
|
||||||
|
prompt_msg_list = g_list_remove(prompt_msg_list, p);
|
||||||
|
prompt_unref(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void prompt_show_message(const gchar *msg, const gchar *answer)
|
||||||
|
{
|
||||||
|
ObPrompt *p;
|
||||||
|
ObPromptAnswer ans[] = {
|
||||||
|
{ answer, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
p = prompt_new(msg, ans, 1, 0, 0, prompt_show_message_cb, NULL);
|
||||||
|
prompt_msg_list = g_list_prepend(prompt_msg_list, p);
|
||||||
|
prompt_show(p, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
|
@ -107,4 +107,6 @@ gboolean prompt_key_event(ObPrompt *self, XEvent *e);
|
||||||
gboolean prompt_mouse_event(ObPrompt *self, XEvent *e);
|
gboolean prompt_mouse_event(ObPrompt *self, XEvent *e);
|
||||||
void prompt_cancel(ObPrompt *self);
|
void prompt_cancel(ObPrompt *self);
|
||||||
|
|
||||||
|
void prompt_show_message(const gchar *msg, const gchar *answer);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
openbox/actions.c
|
openbox/actions.c
|
||||||
openbox/actions/execute.c
|
openbox/actions/execute.c
|
||||||
openbox/actions/exit.c
|
openbox/actions/exit.c
|
||||||
|
openbox/actions/session.c
|
||||||
openbox/client.c
|
openbox/client.c
|
||||||
openbox/client_list_combined_menu.c
|
openbox/client_list_combined_menu.c
|
||||||
openbox/client_list_menu.c
|
openbox/client_list_menu.c
|
||||||
|
|
Loading…
Reference in a new issue