Пример #1
0
static Evas_Object *
_e_util_icon_add(const char *path, Evas *evas, int size)
{
   Evas_Object *o = NULL;
   const char *ext;

   if (!path) return NULL;
   if (!ecore_file_exists(path)) return NULL;

   o = e_icon_add(evas);
   e_icon_scale_size_set(o, size);
   e_icon_preload_set(o, 1);
   ext = strrchr(path, '.');
   if (ext)
     {
        if (!strcmp(ext, ".edj"))
          e_icon_file_edje_set(o, path, "icon");
        else
          e_icon_file_set(o, path);
     }
   else
     e_icon_file_set(o, path);
   e_icon_fill_inside_set(o, 1);

   return o;
}
Пример #2
0
void
news_config_dialog_item_content_refresh_selected_feeds(News_Item *ni)
{
   E_Config_Dialog_Data *cfdata;
   Evas_Object *ilist;
   int pos, iw, ih;
  
   if (!ni->config_dialog_content) return;
   cfdata = ni->config_dialog_content->cfdata;

   ilist = cfdata->ilist_selected_feeds;
   e_widget_ilist_freeze(ilist);
   /* disable the callback until we finish to refresh the list */
   e_widget_on_change_hook_set(ilist, NULL, NULL);

   e_widget_ilist_clear(ilist);
   if (cfdata->button_rem)
     {
        e_widget_disabled_set(cfdata->button_rem, 1);
        e_widget_disabled_set(cfdata->button_up, 1);
        e_widget_disabled_set(cfdata->button_down, 1);
     }

   cfdata->ilist_selected_feeds_inrefresh = 1;
   pos = -1;
   NEWS_ITEM_FEEDS_FOREACH_BEG(ni);
   {
      Evas_Object *ic = NULL;
      char buf[1024];
        
        if (_feed->icon && _feed->icon[0])
          {
             ic = e_icon_add(evas_object_evas_get(ilist));
             e_icon_file_set(ic, _feed->icon);
          }

        snprintf(buf, sizeof(buf), "%s%s", (_feed->important) ? "[i] " : "", _feed->name);

        e_widget_ilist_append(ilist, ic, buf, NULL, _feed, NULL);
	pos++;

	if (eina_list_data_find(cfdata->ilist_selected_feeds_sel, _feed))
          e_widget_ilist_multi_select(ilist, pos);
   }
   NEWS_ITEM_FEEDS_FOREACH_END();
   cfdata->ilist_selected_feeds_inrefresh = 0;

   e_widget_size_min_get(ilist, &iw, &ih);
   if (iw < 200) iw = 200;
   e_widget_size_min_set(ilist, iw, 250);
   
   e_widget_ilist_go(ilist);
   e_widget_ilist_thaw(ilist);
   _cb_selected_feed_change(cfdata, NULL);
   /* restore the callback */
   e_widget_on_change_hook_set(ilist, _cb_selected_feed_change, cfdata);
}
Пример #3
0
EAPI Eina_Bool
e_icon_fdo_icon_set(Evas_Object *obj, const char *icon)
{
   E_Smart_Data *sd;
   const char *path;
   int len;

   if (!icon) return EINA_FALSE;
   if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
   if (icon[0] == '/') return e_icon_file_set(obj, icon);

   if (!(sd = evas_object_smart_data_get(obj)))
     return EINA_FALSE;

   if (sd->timer) ecore_timer_del(sd->timer);
   sd->timer = NULL;
   if (sd->guessing_animation) ecore_timer_del(sd->guessing_animation);
   sd->guessing_animation = NULL;
   sd->frame = 0;
   sd->frame_count = 0;
   sd->edje = EINA_FALSE;

   eina_stringshare_replace(&sd->fdo, icon);
   if (!sd->fdo) return EINA_FALSE;

   path = efreet_icon_path_find(e_config->icon_theme, sd->fdo, sd->size);
   if (!path) return EINA_FALSE;

   len = strlen(icon);
   if ((len > 4) && (!strcasecmp(icon + len - 4, ".edj")))
     return e_icon_file_edje_set(obj, path, "icon");

   /* smart code here */
   _e_icon_obj_prepare(obj, sd);
   sd->loading = 0;
   if (sd->size != 0)
     evas_object_image_load_size_set(sd->obj, sd->size, sd->size);
   if (sd->preload) evas_object_hide(sd->obj);
   evas_object_image_file_set(sd->obj, path, NULL);
   if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE)
     return EINA_FALSE;
   if (sd->preload)
     {
        sd->loading = 1;
        evas_object_image_preload(sd->obj, 0);
     }
   else if (evas_object_visible_get(obj))
     evas_object_show(sd->obj);
   _e_icon_smart_reconfigure(sd);
   return EINA_TRUE;
}
Пример #4
0
static int
_e_util_icon_fdo_set(Evas_Object *obj, const char *icon)
{
   const char *path = NULL;
   unsigned int size;

   if ((!icon) || (!icon[0])) return 0;
   size = e_icon_scale_size_get(obj);
   if (size < 16) size = 16;
   size = e_util_icon_size_normalize(size * e_scale);

   path = efreet_icon_path_find(e_config->icon_theme, icon, size);
   if (!path) return 0;

   e_icon_file_set(obj, path);
   return 1;
}
Пример #5
0
/* use e_icon_size_scale_set(obj, size) to set the preferred icon size */
E_API int
e_util_icon_theme_set(Evas_Object *obj, const char *icon)
{
   if (icon && (icon[0] == '/'))
     {
        if (e_icon_file_set(obj, icon)) return 1;
     }
   if (e_config->icon_theme_overrides)
     {
        if (_e_util_icon_fdo_set(obj, icon))
          return 1;
        if (_e_util_icon_theme_set(obj, icon, EINA_FALSE))
          return 1;
        return _e_util_icon_theme_set(obj, icon, EINA_TRUE);
     }
   else
     {
        if (_e_util_icon_theme_set(obj, icon, EINA_FALSE))
          return 1;
        if (_e_util_icon_fdo_set(obj, icon))
          return 1;
        return _e_util_icon_theme_set(obj, icon, EINA_TRUE);
     }
}
Пример #6
0
/**  
 * Creates a check box widget with icon
 *
 * @param evas pointer
 * @param label the text to asign to check widget
 * @param icon the path to the icon file
 * @param icon_w the minimum wdith of the icon
 * @param icon_h the minumum height of the icon
 * @param val pointer to int where changes are stored
 * @return the newly created evas object
 */
EAPI Evas_Object *
e_widget_check_icon_add(Evas *evas, const char *label, const char *icon, int icon_w, int icon_h, int *val)
{
   Evas_Object *obj, *o, *o2;
   E_Widget_Data *wd;
   Evas_Coord mw, mh;

   obj = e_widget_add(evas);

   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_focus_hook_set(obj, _e_wid_focus_hook);
   e_widget_activate_hook_set(obj, _e_wid_activate_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);
   wd = calloc(1, sizeof(E_Widget_Data));
   wd->valptr = val;
   e_widget_data_set(obj, wd);

   o = edje_object_add(evas);
   wd->o_check = o;
   e_theme_edje_object_set(o, "base/theme/widgets",
                           "e/widgets/check_icon");
   edje_object_signal_callback_add(o, "e,action,toggle", "*", _e_wid_signal_cb1, obj);
   edje_object_part_text_set(o, "e.text.label", label);
   evas_object_show(o);
   if (label)
     {
        edje_object_signal_emit(o, "e,state,labeled", "e");
        edje_object_message_signal_process(o);
     }
   if (icon)
     {
        if (icon[0] == '/')
          {
             o2 = e_icon_add(evas);
             e_icon_file_set(o2, icon);
          }
        else
          {
             o2 = edje_object_add(evas);
             e_util_edje_icon_set(o2, icon);
          }
        evas_object_size_hint_min_set(o2, icon_w, icon_h);
        edje_object_part_swallow(wd->o_check, "e.swallow.icon", o2);
        evas_object_show(o2);
        e_widget_sub_object_add(obj, o2);
        wd->o_icon = o2;
     }

   edje_object_size_min_calc(o, &mw, &mh);
   e_widget_size_min_set(obj, mw, mh);
   if (wd->valptr)
     {
        if (*(wd->valptr)) edje_object_signal_emit(o, "e,state,checked", "e");
     }

   e_widget_sub_object_add(obj, o);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
   e_widget_resize_object_set(obj, o);

   return obj;
}
Пример #7
0
void
news_config_dialog_item_content_refresh_feeds(News_Item *ni)
{
   E_Config_Dialog_Data *cfdata;
   Eina_List *l, *l2;
   Evas_Object *ilist;
   int pos;
   int iw, ih;
  
   if (!ni->config_dialog_content) return;
   cfdata = ni->config_dialog_content->cfdata;

   ilist = cfdata->ilist_feeds;
   e_widget_ilist_freeze(ilist);
   /* disable the callback until we finish to refresh the list */
   e_widget_on_change_hook_set(ilist, NULL, NULL);

   e_widget_ilist_clear(ilist);
   if (cfdata->button_add)
     e_widget_disabled_set(cfdata->button_add, 1);

   pos = -1;
   for(l=news->config->feed.categories; l; l=eina_list_next(l))
     {
        News_Feed_Category *cat;
        Evas_Object *iccat = NULL;

        cat = eina_list_data_get(l);

        if (!cat->feeds_visible)
          continue;

        if (cat->icon)
          {
             iccat = e_icon_add(evas_object_evas_get(ilist));
             e_icon_file_set(iccat, cat->icon);
          }

        e_widget_ilist_header_append(ilist, iccat, cat->name);
	pos++;

        for(l2=cat->feeds_visible; l2; l2=eina_list_next(l2))
          {
             Evas_Object *ic = NULL;
             News_Feed *f;
             char buf[1024];
             
             f = eina_list_data_get(l2);
             
             if (f->icon && f->icon[0])
               {
                  ic = e_icon_add(evas_object_evas_get(ilist));
                  e_icon_file_set(ic, f->icon);
               }
             
             snprintf(buf, sizeof(buf), "%s%s", (f->important) ? "[i] " : "", f->name);
             
             e_widget_ilist_append(ilist, ic, buf, NULL, f, NULL);
	     pos++;

	     if (eina_list_data_find(cfdata->ilist_feeds_sel, f))
               e_widget_ilist_multi_select(ilist, pos);
          }
     }
   e_widget_ilist_thaw(ilist);

   e_widget_size_min_get(ilist, &iw, &ih);
   if (iw < 200) iw = 200;
   e_widget_size_min_set(ilist, iw, 250);
   
   e_widget_ilist_go(ilist);
   _cb_feed_change(cfdata, NULL);
   /* restore the callback */
   e_widget_on_change_hook_set(ilist, _cb_feed_change, cfdata);
}