From: Enlightenment S. <no-...@en...> - 2010-08-26 00:40:38
|
Log: Move the toolbar to the bottom for consistency and fix segv when clicking View Large while no pictures are populated. Author: titan Date: 2010-08-25 17:40:31 -0700 (Wed, 25 Aug 2010) New Revision: 51649 Modified: trunk/ephoto/src/bin/ephoto_flow_browser.c trunk/ephoto/src/bin/ephoto_thumb_browser.c Modified: trunk/ephoto/src/bin/ephoto_flow_browser.c =================================================================== --- trunk/ephoto/src/bin/ephoto_flow_browser.c 2010-08-25 19:37:03 UTC (rev 51648) +++ trunk/ephoto/src/bin/ephoto_flow_browser.c 2010-08-26 00:40:31 UTC (rev 51649) @@ -84,36 +84,46 @@ Elm_Toolbar_Item *o; int i; - cur_image = current_image; + if (current_image) + { + cur_image = current_image; - evas_object_event_callback_add(em->flow_browser, EVAS_CALLBACK_KEY_UP, - _ephoto_key_pressed, NULL); + evas_object_event_callback_add(em->flow_browser, EVAS_CALLBACK_KEY_UP, + _ephoto_key_pressed, NULL); - iter = eina_list_data_find_list(em->images, current_image); - for (i = 0; i < (sizeof (toolbar_items) / sizeof (char*)); ++i) - { - o = elm_toolbar_item_find_by_label(toolbar, toolbar_items[i]); - elm_toolbar_item_disabled_set(o, !iter ? EINA_TRUE : EINA_FALSE); - } + iter = eina_list_data_find_list(em->images, current_image); + for (i = 0; i < (sizeof (toolbar_items) / sizeof (char*)); ++i) + { + o = elm_toolbar_item_find_by_label(toolbar, toolbar_items[i]); + elm_toolbar_item_disabled_set(o, !iter ? EINA_TRUE : EINA_FALSE); + } - elm_box_unpack(em->flow_browser, image); - elm_box_unpack(em->flow_browser, image2); - elm_box_unpack(em->flow_browser, toolbar); + elm_box_unpack(em->flow_browser, image); + elm_box_unpack(em->flow_browser, image2); + elm_box_unpack(em->flow_browser, toolbar); - file_type = strrchr(current_image, '.'); - if (strncasecmp(file_type, ".jpg", 4) && strncasecmp(file_type, ".jpeg", 5)) - { - elm_image_file_set(image2, current_image, NULL); - elm_box_pack_end(em->flow_browser, image2); - evas_object_show(image2); + file_type = strrchr(current_image, '.'); + if (strncasecmp(file_type, ".jpg", 4) && strncasecmp(file_type, ".jpeg", 5)) + { + elm_image_file_set(image2, current_image, NULL); + elm_box_pack_end(em->flow_browser, image2); + evas_object_show(image2); + } + else + { + elm_photocam_file_set(image, current_image); + elm_box_pack_end(em->flow_browser, image); + evas_object_show(image); + } } else { - elm_photocam_file_set(image, current_image); - elm_box_pack_end(em->flow_browser, image); - evas_object_show(image); + for (i = 0; i < (sizeof (toolbar_items) / sizeof (char*)); ++i) + { + o = elm_toolbar_item_find_by_label(toolbar, toolbar_items[i]); + elm_toolbar_item_disabled_set(o, EINA_TRUE); + } } - elm_box_pack_end(em->flow_browser, toolbar); evas_object_show(toolbar); evas_object_show(em->flow_browser); Modified: trunk/ephoto/src/bin/ephoto_thumb_browser.c =================================================================== --- trunk/ephoto/src/bin/ephoto_thumb_browser.c 2010-08-25 19:37:03 UTC (rev 51648) +++ trunk/ephoto/src/bin/ephoto_thumb_browser.c 2010-08-26 00:40:31 UTC (rev 51649) @@ -52,29 +52,28 @@ { current_directory = eina_stringshare_add(directory); } - toolbar = elm_toolbar_add(em->win); - elm_toolbar_icon_size_set(toolbar, 24); - elm_toolbar_homogenous_set(toolbar, EINA_TRUE); - evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0.0); - evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, 0.5); - elm_box_pack_end(em->box, toolbar); - o = elm_icon_add(em->win); - elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/change_directory.png", NULL); - elm_toolbar_item_add(toolbar, o, "Change Directory", _ephoto_change_directory, NULL); + thbox = elm_box_add(em->win); + elm_box_horizontal_set(thbox, EINA_TRUE); + evas_object_size_hint_weight_set(thbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_size_hint_fill_set(thbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(em->box, thbox); - o = elm_icon_add(em->win); - elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/filter.png", NULL); - elm_toolbar_item_add(toolbar, o, "Filter", NULL, NULL); + dir_label = elm_label_add(em->win); + elm_label_label_set(dir_label, buf); + evas_object_size_hint_weight_set(dir_label, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(dir_label, 0.01, 0.5); + elm_box_pack_end(thbox, dir_label); - o = elm_icon_add(em->win); - elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/view_presentation.png", NULL); - elm_toolbar_item_add(toolbar, o, "View Large", _ephoto_view_large, NULL); + thumb_slider = elm_slider_add(em->win); + elm_slider_label_set(thumb_slider, "Thumb Size:"); + elm_slider_span_size_set(thumb_slider, 100); + elm_slider_min_max_set(thumb_slider, 0, 100); + elm_slider_value_set(thumb_slider, 50); + elm_box_pack_end(thbox, thumb_slider); + evas_object_smart_callback_add(thumb_slider, "changed", + _ephoto_slider_changed, NULL); - o = elm_icon_add(em->win); - elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL); - elm_toolbar_item_add(toolbar, o, "Play Slideshow", _ephoto_view_slideshow, NULL); - em->thumb_browser = elm_gengrid_add(em->win); elm_gengrid_align_set(em->thumb_browser, 0.5, 0.6); elm_gengrid_item_size_set(em->thumb_browser, 208, 146); @@ -86,26 +85,30 @@ evas_object_smart_callback_add(em->thumb_browser, "clicked", _ephoto_thumb_clicked, NULL); elm_box_pack_end(em->box, em->thumb_browser); - thbox = elm_box_add(em->win); - elm_box_horizontal_set(thbox, EINA_TRUE); - evas_object_size_hint_weight_set(thbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL); - evas_object_size_hint_fill_set(thbox, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_box_pack_end(em->box, thbox); + toolbar = elm_toolbar_add(em->win); + elm_toolbar_icon_size_set(toolbar, 24); + elm_toolbar_homogenous_set(toolbar, EINA_TRUE); + elm_toolbar_scrollable_set(toolbar, EINA_FALSE); + evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(em->box, toolbar); - dir_label = elm_label_add(em->win); - elm_label_label_set(dir_label, buf); - evas_object_size_hint_weight_set(dir_label, EVAS_HINT_EXPAND, 0.0); - evas_object_size_hint_align_set(dir_label, 0.01, 0.5); - elm_box_pack_end(thbox, dir_label); + o = elm_icon_add(em->win); + elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/change_directory.png", NULL); + elm_toolbar_item_add(toolbar, o, "Change Directory", _ephoto_change_directory, NULL); - thumb_slider = elm_slider_add(em->win); - elm_slider_label_set(thumb_slider, "Thumb Size:"); - elm_slider_span_size_set(thumb_slider, 100); - elm_slider_min_max_set(thumb_slider, 0, 100); - elm_slider_value_set(thumb_slider, 50); - elm_box_pack_end(thbox, thumb_slider); - evas_object_smart_callback_add(thumb_slider, "changed", - _ephoto_slider_changed, NULL); + o = elm_icon_add(em->win); + elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/filter.png", NULL); + elm_toolbar_item_add(toolbar, o, "Filter", NULL, NULL); + + o = elm_icon_add(em->win); + elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/view_presentation.png", NULL); + elm_toolbar_item_add(toolbar, o, "View Large", _ephoto_view_large, NULL); + + o = elm_icon_add(em->win); + elm_icon_file_set(o, PACKAGE_DATA_DIR "/images/play_slideshow.png", NULL); + elm_toolbar_item_add(toolbar, o, "Play Slideshow", _ephoto_view_slideshow, NULL); + cur_val = 50; eg.item_style = "ephoto"; |