Make the popup optional, small theme fix.
SVN revision: 42167
This commit is contained in:
parent
073de78837
commit
46851ab31f
30
mpdule.edc
30
mpdule.edc
|
@ -475,6 +475,28 @@ collections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
part
|
||||||
|
{
|
||||||
|
name:"event_grab";
|
||||||
|
type:RECT;
|
||||||
|
repeat_events:1;
|
||||||
|
description
|
||||||
|
{
|
||||||
|
state:"default" 0.00;
|
||||||
|
visible:1;
|
||||||
|
color:0 0 0 0;
|
||||||
|
rel1
|
||||||
|
{
|
||||||
|
relative:0.00 0.00;
|
||||||
|
offset:0 0;
|
||||||
|
}
|
||||||
|
rel2
|
||||||
|
{
|
||||||
|
relative:1.00 1.00;
|
||||||
|
offset:-1 -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
programs
|
programs
|
||||||
{
|
{
|
||||||
|
@ -482,7 +504,7 @@ collections
|
||||||
{
|
{
|
||||||
name:"show_controls";
|
name:"show_controls";
|
||||||
signal:"mouse,in";
|
signal:"mouse,in";
|
||||||
source:"item_clip";
|
source:"event_grab";
|
||||||
action:STATE_SET "show" 0.0;
|
action:STATE_SET "show" 0.0;
|
||||||
transition:LINEAR 0.1;
|
transition:LINEAR 0.1;
|
||||||
target:"controls_clip";
|
target:"controls_clip";
|
||||||
|
@ -491,7 +513,7 @@ collections
|
||||||
{
|
{
|
||||||
name:"show_controls2";
|
name:"show_controls2";
|
||||||
signal:"mouse,in";
|
signal:"mouse,in";
|
||||||
source:"item_clip";
|
source:"event_grab";
|
||||||
action:STATE_SET "hide" 0.0;
|
action:STATE_SET "hide" 0.0;
|
||||||
transition:LINEAR 0.1;
|
transition:LINEAR 0.1;
|
||||||
target:"item_clip";
|
target:"item_clip";
|
||||||
|
@ -509,7 +531,7 @@ collections
|
||||||
{
|
{
|
||||||
name:"hide_controls";
|
name:"hide_controls";
|
||||||
signal:"mouse,out";
|
signal:"mouse,out";
|
||||||
source:"controls_clip";
|
source:"event_grab";
|
||||||
action:STATE_SET "default" 0.0;
|
action:STATE_SET "default" 0.0;
|
||||||
transition:LINEAR 0.1;
|
transition:LINEAR 0.1;
|
||||||
target:"controls_clip";
|
target:"controls_clip";
|
||||||
|
@ -518,7 +540,7 @@ collections
|
||||||
{
|
{
|
||||||
name:"hide_controls2";
|
name:"hide_controls2";
|
||||||
signal:"mouse,out";
|
signal:"mouse,out";
|
||||||
source:"controls_clip";
|
source:"event_grab";
|
||||||
action:STATE_SET "default" 0.0;
|
action:STATE_SET "default" 0.0;
|
||||||
transition:LINEAR 0.1;
|
transition:LINEAR 0.1;
|
||||||
target:"item_clip";
|
target:"item_clip";
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
#include <e.h>
|
#include <e.h>
|
||||||
#include "e_mod_main.h"
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
|
@ -6,6 +9,7 @@ struct _E_Config_Dialog_Data
|
||||||
int poll_time;
|
int poll_time;
|
||||||
char *hostname;
|
char *hostname;
|
||||||
char *port;
|
char *port;
|
||||||
|
int show_popup;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Protos */
|
/* Protos */
|
||||||
|
@ -49,6 +53,7 @@ _fill_data (Config_Item * ci, E_Config_Dialog_Data * cfdata)
|
||||||
cfdata->hostname = strdup (ci->hostname);
|
cfdata->hostname = strdup (ci->hostname);
|
||||||
snprintf (buf, sizeof (buf), "%d", ci->port);
|
snprintf (buf, sizeof (buf), "%d", ci->port);
|
||||||
cfdata->port = strdup (buf);
|
cfdata->port = strdup (buf);
|
||||||
|
cfdata->show_popup = ci->show_popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -104,6 +109,9 @@ _basic_create_widgets (E_Config_Dialog * cfd, Evas * evas,
|
||||||
e_widget_frametable_object_append (of, port_entry, 0, 5, 1, 1, 1, 0, 1, 0);
|
e_widget_frametable_object_append (of, port_entry, 0, 5, 1, 1, 1, 0, 1, 0);
|
||||||
e_widget_list_object_append (o, of, 1, 1, 0.5);
|
e_widget_list_object_append (o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
ob = e_widget_check_add(evas, D_("Show Popup:"), &(cfdata->show_popup));
|
||||||
|
e_widget_frametable_object_append(of, ob, 0, 6, 1, 1, 1, 0, 1, 0);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +126,7 @@ _basic_apply_data (E_Config_Dialog * cfd, E_Config_Dialog_Data * cfdata)
|
||||||
eina_stringshare_del (ci->hostname);
|
eina_stringshare_del (ci->hostname);
|
||||||
ci->hostname = eina_stringshare_add (cfdata->hostname);
|
ci->hostname = eina_stringshare_add (cfdata->hostname);
|
||||||
ci->port = atoi (cfdata->port);
|
ci->port = atoi (cfdata->port);
|
||||||
|
ci->show_popup = cfdata->show_popup;
|
||||||
e_config_save_queue ();
|
e_config_save_queue ();
|
||||||
_mpdule_config_updated (ci);
|
_mpdule_config_updated (ci);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
102
src/e_mod_main.c
102
src/e_mod_main.c
|
@ -1,3 +1,6 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
#include <e.h>
|
#include <e.h>
|
||||||
#include "e_mod_main.h"
|
#include "e_mod_main.h"
|
||||||
#if TIME_WITH_SYS_TIME
|
#if TIME_WITH_SYS_TIME
|
||||||
|
@ -76,16 +79,16 @@ static void _mpdule_disconnect (Instance * inst);
|
||||||
static void _mpdule_update_song (Instance * inst);
|
static void _mpdule_update_song (Instance * inst);
|
||||||
static int _mpdule_update_song_cb (void *data);
|
static int _mpdule_update_song_cb (void *data);
|
||||||
static void _mpdule_popup_destroy (Instance * inst);
|
static void _mpdule_popup_destroy (Instance * inst);
|
||||||
|
static void _mpdule_popup_create (Instance * inst, const char *dir);
|
||||||
|
|
||||||
static E_Gadcon_Client *
|
static E_Gadcon_Client *
|
||||||
_gc_init (E_Gadcon * gc, const char *name, const char *id, const char *style)
|
_gc_init (E_Gadcon * gc, const char *name, const char *id, const char *style)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *o_popup;
|
Evas_Object *o;
|
||||||
E_Gadcon_Client *gcc;
|
E_Gadcon_Client *gcc;
|
||||||
Evas *evas;
|
Evas *evas;
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
int w, h;
|
|
||||||
|
|
||||||
inst = E_NEW (Instance, 1);
|
inst = E_NEW (Instance, 1);
|
||||||
|
|
||||||
|
@ -106,17 +109,7 @@ _gc_init (E_Gadcon * gc, const char *name, const char *id, const char *style)
|
||||||
inst->gcc = gcc;
|
inst->gcc = gcc;
|
||||||
inst->mpdule = o;
|
inst->mpdule = o;
|
||||||
|
|
||||||
inst->popup = e_gadcon_popup_new (inst->gcc);
|
_mpdule_popup_create(inst, buf);
|
||||||
|
|
||||||
evas = inst->popup->win->evas;
|
|
||||||
o_popup = edje_object_add (evas);
|
|
||||||
if (!e_theme_edje_object_set
|
|
||||||
(o_popup, "base/theme/modules/mpdule", "modules/mpdule/popup"))
|
|
||||||
edje_object_file_set (o_popup, buf, "modules/mpdule/popup");
|
|
||||||
evas_object_show (o_popup);
|
|
||||||
e_gadcon_popup_content_set (inst->popup, o_popup);
|
|
||||||
edje_object_size_min_calc (o_popup, &w, &h);
|
|
||||||
inst->o_popup = o_popup;
|
|
||||||
|
|
||||||
evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN,
|
evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN,
|
||||||
_mpdule_cb_mouse_down, inst);
|
_mpdule_cb_mouse_down, inst);
|
||||||
|
@ -134,16 +127,6 @@ _gc_init (E_Gadcon * gc, const char *name, const char *id, const char *style)
|
||||||
inst);
|
inst);
|
||||||
edje_object_signal_callback_add (o, "mpdule,previous", "",
|
edje_object_signal_callback_add (o, "mpdule,previous", "",
|
||||||
_mpdule_cb_previous, inst);
|
_mpdule_cb_previous, inst);
|
||||||
edje_object_signal_callback_add (o_popup, "mpdule,play", "",
|
|
||||||
_mpdule_cb_play, inst);
|
|
||||||
edje_object_signal_callback_add (o_popup, "mpdule,stop", "",
|
|
||||||
_mpdule_cb_stop, inst);
|
|
||||||
edje_object_signal_callback_add (o_popup, "mpdule,pause", "",
|
|
||||||
_mpdule_cb_pause, inst);
|
|
||||||
edje_object_signal_callback_add (o_popup, "mpdule,next", "",
|
|
||||||
_mpdule_cb_next, inst);
|
|
||||||
edje_object_signal_callback_add (o_popup, "mpdule,previous", "",
|
|
||||||
_mpdule_cb_previous, inst);
|
|
||||||
_mpdule_connect (inst);
|
_mpdule_connect (inst);
|
||||||
_mpdule_update_song (inst);
|
_mpdule_update_song (inst);
|
||||||
inst->update_timer = ecore_timer_add (inst->ci->poll_time,
|
inst->update_timer = ecore_timer_add (inst->ci->poll_time,
|
||||||
|
@ -268,7 +251,7 @@ _mpdule_cb_mouse_in (void *data, Evas * e, Evas_Object * obj,
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
E_Gadcon_Popup *popup;
|
E_Gadcon_Popup *popup;
|
||||||
|
|
||||||
if (!(inst = data))
|
if ((!(inst = data)) || (!inst->ci->show_popup))
|
||||||
return;
|
return;
|
||||||
popup = inst->popup;
|
popup = inst->popup;
|
||||||
e_gadcon_popup_show (inst->popup);
|
e_gadcon_popup_show (inst->popup);
|
||||||
|
@ -281,7 +264,7 @@ _mpdule_cb_mouse_out (void *data, Evas * e, Evas_Object * obj,
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
E_Gadcon_Popup *popup;
|
E_Gadcon_Popup *popup;
|
||||||
|
|
||||||
if (!(inst = data))
|
if ((!(inst = data)) || ((!inst->ci->show_popup) && (inst->popup)))
|
||||||
return;
|
return;
|
||||||
popup = inst->popup;
|
popup = inst->popup;
|
||||||
e_gadcon_popup_hide (inst->popup);
|
e_gadcon_popup_hide (inst->popup);
|
||||||
|
@ -328,6 +311,24 @@ _mpdule_config_updated (Config_Item * ci)
|
||||||
inst->update_timer =
|
inst->update_timer =
|
||||||
ecore_timer_add (ci->poll_time, _mpdule_update_song_cb,
|
ecore_timer_add (ci->poll_time, _mpdule_update_song_cb,
|
||||||
inst);
|
inst);
|
||||||
|
if (inst->ci->show_popup)
|
||||||
|
{
|
||||||
|
if (!inst->popup)
|
||||||
|
{
|
||||||
|
_mpdule_popup_create(inst, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (inst->popup)
|
||||||
|
{
|
||||||
|
_mpdule_popup_destroy(inst);
|
||||||
|
}
|
||||||
|
if (inst->o_popup)
|
||||||
|
{
|
||||||
|
evas_object_del(inst->o_popup);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -433,6 +434,7 @@ _mpdule_config_item_get (const char *id)
|
||||||
ci->poll_time = 1.0;
|
ci->poll_time = 1.0;
|
||||||
ci->hostname = eina_stringshare_add ("localhost");
|
ci->hostname = eina_stringshare_add ("localhost");
|
||||||
ci->port = 6600;
|
ci->port = 6600;
|
||||||
|
ci->show_popup = 1;
|
||||||
|
|
||||||
mpdule_config->items = eina_list_append (mpdule_config->items, ci);
|
mpdule_config->items = eina_list_append (mpdule_config->items, ci);
|
||||||
return ci;
|
return ci;
|
||||||
|
@ -699,6 +701,7 @@ e_modapi_init (E_Module * m)
|
||||||
E_CONFIG_VAL (D, T, poll_time, DOUBLE);
|
E_CONFIG_VAL (D, T, poll_time, DOUBLE);
|
||||||
E_CONFIG_VAL (D, T, hostname, STR);
|
E_CONFIG_VAL (D, T, hostname, STR);
|
||||||
E_CONFIG_VAL (D, T, port, INT);
|
E_CONFIG_VAL (D, T, port, INT);
|
||||||
|
E_CONFIG_VAL (D, T, show_popup, UCHAR);
|
||||||
|
|
||||||
conf_edd = E_CONFIG_DD_NEW ("MPDule_Config", Config);
|
conf_edd = E_CONFIG_DD_NEW ("MPDule_Config", Config);
|
||||||
#undef T
|
#undef T
|
||||||
|
@ -719,6 +722,7 @@ e_modapi_init (E_Module * m)
|
||||||
ci->poll_time = 1.0;
|
ci->poll_time = 1.0;
|
||||||
ci->hostname = eina_stringshare_add ("localhost");
|
ci->hostname = eina_stringshare_add ("localhost");
|
||||||
ci->port = 6600;
|
ci->port = 6600;
|
||||||
|
ci->show_popup = 1;
|
||||||
|
|
||||||
mpdule_config->items = eina_list_append (mpdule_config->items, ci);
|
mpdule_config->items = eina_list_append (mpdule_config->items, ci);
|
||||||
}
|
}
|
||||||
|
@ -777,3 +781,51 @@ _mpdule_popup_destroy (Instance * inst)
|
||||||
return;
|
return;
|
||||||
e_object_del (E_OBJECT (inst->popup));
|
e_object_del (E_OBJECT (inst->popup));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_mpdule_popup_create (Instance * inst, const char *dir)
|
||||||
|
{
|
||||||
|
Evas *evas;
|
||||||
|
Evas_Object *o_popup;
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
|
if (inst->ci->show_popup)
|
||||||
|
{
|
||||||
|
inst->popup = e_gadcon_popup_new (inst->gcc);
|
||||||
|
evas = inst->popup->win->evas;
|
||||||
|
o_popup = edje_object_add (evas);
|
||||||
|
if (!e_theme_edje_object_set
|
||||||
|
(o_popup, "base/theme/modules/mpdule", "modules/mpdule/popup"))
|
||||||
|
{
|
||||||
|
if (dir)
|
||||||
|
{
|
||||||
|
edje_object_file_set (o_popup, dir, "modules/mpdule/popup");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s/mpdule.edj",
|
||||||
|
e_module_dir_get(mpdule_config->module));
|
||||||
|
edje_object_file_set(o_popup, buf, "modules/mpdule/popup");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
evas_object_show (o_popup);
|
||||||
|
e_gadcon_popup_content_set (inst->popup, o_popup);
|
||||||
|
edje_object_size_min_calc (o_popup, NULL, NULL);
|
||||||
|
inst->o_popup = o_popup;
|
||||||
|
edje_object_signal_callback_add (o_popup, "mpdule,play", "",
|
||||||
|
_mpdule_cb_play, inst);
|
||||||
|
edje_object_signal_callback_add (o_popup, "mpdule,stop", "",
|
||||||
|
_mpdule_cb_stop, inst);
|
||||||
|
edje_object_signal_callback_add (o_popup, "mpdule,pause", "",
|
||||||
|
_mpdule_cb_pause, inst);
|
||||||
|
edje_object_signal_callback_add (o_popup, "mpdule,next", "",
|
||||||
|
_mpdule_cb_next, inst);
|
||||||
|
edje_object_signal_callback_add (o_popup, "mpdule,previous", "",
|
||||||
|
_mpdule_cb_previous, inst);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inst->popup = NULL;
|
||||||
|
inst->o_popup = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
#define D_(str) dgettext(PACKAGE, str)
|
#define D_(str) dgettext(PACKAGE, str)
|
||||||
|
|
||||||
#ifndef E_MOD_MAIN_H
|
#ifndef E_MOD_MAIN_H
|
||||||
|
@ -24,6 +27,7 @@ struct _Config_Item
|
||||||
double poll_time;
|
double poll_time;
|
||||||
const char *hostname;
|
const char *hostname;
|
||||||
int port;
|
int port;
|
||||||
|
int show_popup;
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI extern E_Module_Api e_modapi;
|
EAPI extern E_Module_Api e_modapi;
|
||||||
|
|
Loading…
Reference in New Issue