示例#1
0
ELAPI void *
el_about(void) 
{
   Etk_Widget *win, *vbox, *hbox;
   Etk_Widget *button, *label;
   Etk_Widget *about;
   Etk_Textblock *msg;
   Etk_Textblock_Iter *iter;
   char buf[4096];
   
   win = etk_dialog_new();
   etk_window_title_set(ETK_WINDOW(win), "About "PACKAGE_NAME);
   etk_window_wmclass_set(ETK_WINDOW(win), PACKAGE"_About", PACKAGE_NAME"_About");
   etk_container_border_width_set(ETK_CONTAINER(win), 3);
   etk_signal_connect("delete_event", ETK_OBJECT(win), ETK_CALLBACK(_close_cb), NULL);

   vbox = etk_vbox_new(ETK_FALSE, 0);
   etk_container_add(ETK_CONTAINER(win), vbox);
   
   label = etk_label_new("<h1>"PACKAGE_NAME"</h1>");
   etk_label_alignment_set(ETK_LABEL(label), 0.5, 0.5);
   etk_box_append(ETK_BOX(vbox), label, ETK_BOX_START, ETK_BOX_NONE, 0);

   snprintf(buf, sizeof(buf), 
	    "<b>%s is an Etk-based IRC client in development</b>\n\n"
	    "Christopher 'devilhorns' Michael\n\n%s\n", 
	    PACKAGE_NAME, PACKAGE_BUGREPORT);
   about = etk_text_view_new();
   etk_widget_size_request_set(about, 250, 150);
   etk_box_append(ETK_BOX(vbox), about, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

   msg = etk_text_view_textblock_get(ETK_TEXT_VIEW(about));
   etk_textblock_object_cursor_visible_set(ETK_TEXT_VIEW(about)->textblock_object, ETK_FALSE);
   
   iter = etk_textblock_iter_new(msg);
   etk_textblock_iter_forward_end(iter);
   etk_textblock_insert_markup(msg, iter, buf, -1);

   etk_box_append(ETK_BOX(vbox), etk_hseparator_new(), ETK_BOX_END, ETK_BOX_FILL, 5);
   
   hbox = etk_hbox_new(ETK_FALSE, 3);
   etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_END, ETK_BOX_NONE, 0);

   button = etk_button_new_from_stock(ETK_STOCK_DIALOG_CLOSE);
   etk_signal_connect_swapped("clicked", ETK_OBJECT(button), ETK_CALLBACK(_close_cb), win);
   etk_box_append(ETK_BOX(hbox), button, ETK_BOX_END, ETK_BOX_NONE, 0);
   
   return win;
}
示例#2
0
/**
 * @brief Set the progress bar to elapsed_time/total_time
 * @param elapsed_time The time elapsed
 * @param total_time The lenght of the song
 * @param gui A Emphasis_Gui
 */
void
emphasis_player_progress_set(Emphasis_Player_Gui *player,
                             float elapsed_time, int total_time)
{
  char *time;
  
  etk_progress_bar_fraction_set(ETK_PROGRESS_BAR(player->full.progress),
                                (elapsed_time / total_time));
  etk_progress_bar_fraction_set(ETK_PROGRESS_BAR(player->small.progress),
                                (elapsed_time / total_time));

  asprintf(&time, "%d:%02d / %d:%02d", (int) elapsed_time / 60,
                                       (int) elapsed_time % 60, 
                                       total_time / 60, 
                                       total_time % 60);

  etk_label_set(ETK_LABEL(player->full.time) , time);
//  etk_label_set(ETK_LABEL(player->small.time), time);
  etk_progress_bar_text_set(ETK_PROGRESS_BAR(player->small.progress), time);

  free(time);
}
示例#3
0
void
image_frame_update(void)
{
   //Etk_Combobox_Item *item = NULL;
   const char *im;

   //Stop signal propagation
   etk_signal_block("value-changed",ETK_OBJECT(UI_BorderLeftSpinner),
                    ETK_CALLBACK(_image_border_spinners_value_changed_cb),
                    (void*)BORDER_LEFT);
   etk_signal_block("value-changed",ETK_OBJECT(UI_BorderRightSpinner),
                    ETK_CALLBACK(_image_border_spinners_value_changed_cb),
                    (void*)BORDER_RIGHT);
   etk_signal_block("value-changed",ETK_OBJECT(UI_BorderTopSpinner),
                    ETK_CALLBACK(_image_border_spinners_value_changed_cb),
                    (void*)BORDER_TOP);
   etk_signal_block("value-changed",ETK_OBJECT(UI_BorderBottomSpinner),
                    ETK_CALLBACK(_image_border_spinners_value_changed_cb),
                    (void*)BORDER_BOTTOM);
   etk_signal_block("value-changed",ETK_OBJECT(UI_ImageAlphaSlider),
                    ETK_CALLBACK(_image_AlphaSlider_value_changed_cb), NULL);
   etk_signal_block("icon-selected", ETK_OBJECT(UI_ImageBrowserIconbox),
                    ETK_CALLBACK(_image_browser_iconbox_selected_cb), NULL);
   etk_signal_block("toggled", ETK_OBJECT(UI_BorderMiddleCheck),
                    ETK_CALLBACK(_image_BorderMiddleCheck_toggled_cb), NULL);

   if (!etk_string_length_get(Cur.state)) return;
   if (!etk_string_length_get(Cur.part)) return;

   image_tweenlist_populate();
   etk_widget_disabled_set(UI_DeleteTweenButton, TRUE);
   etk_widget_disabled_set(UI_MoveDownTweenButton, TRUE);
   etk_widget_disabled_set(UI_MoveUpTweenButton, TRUE);

   /* Update Image Browser */
   image_browser_update();

   //Set the images label for normal image
   im = edje_edit_state_image_get(edje_o, Cur.part->string, Cur.state->string);
   if (im)
   {
      etk_label_set(ETK_LABEL(UI_ImageNameLabel), im);
      edje_edit_string_free(im);
   }
   else
   {
      etk_label_set(ETK_LABEL(UI_ImageNameLabel), "none");
   }

   //Set alpha and borders
   int alpha, t, l, r, b;
   edje_edit_state_color_get(edje_o, Cur.part->string, Cur.state->string,
                             NULL, NULL, NULL, &alpha);
   edje_edit_state_image_border_get(edje_o, Cur.part->string, Cur.state->string,
                                    &l, &r, &t, &b);
   etk_range_value_set(ETK_RANGE(UI_ImageAlphaSlider), alpha);
   etk_range_value_set(ETK_RANGE(UI_BorderLeftSpinner), l);
   etk_range_value_set(ETK_RANGE(UI_BorderRightSpinner), r);
   etk_range_value_set(ETK_RANGE(UI_BorderTopSpinner), t);
   etk_range_value_set(ETK_RANGE(UI_BorderBottomSpinner), b);
   etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(UI_BorderMiddleCheck),
         edje_edit_state_image_border_fill_get(edje_o, Cur.part->string,
                                                      Cur.state->string));

   //ReEnable Signal Propagation
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderLeftSpinner),
                      _image_border_spinners_value_changed_cb,
                      (void*)BORDER_LEFT);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderRightSpinner),
                      _image_border_spinners_value_changed_cb,
                      (void*)BORDER_RIGHT);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderTopSpinner),
                      _image_border_spinners_value_changed_cb,
                      (void*)BORDER_TOP);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_BorderBottomSpinner),
                      _image_border_spinners_value_changed_cb,
                      (void*)BORDER_BOTTOM);
   etk_signal_unblock("value-changed", ETK_OBJECT(UI_ImageAlphaSlider),
                      _image_AlphaSlider_value_changed_cb, NULL);
   etk_signal_unblock("icon-selected", ETK_OBJECT(UI_ImageBrowserIconbox),
                      ETK_CALLBACK(_image_browser_iconbox_selected_cb), NULL);
   etk_signal_unblock("toggled", ETK_OBJECT(UI_BorderMiddleCheck),
                      ETK_CALLBACK(_image_BorderMiddleCheck_toggled_cb), NULL);
}
示例#4
0
/**
 * @brief Set the message in th textblock
 * @param player A Emphasis_Player_Gui
 * @param song The current playing song
 * @param msg Additional, if song != NULL or the message displayed
 */
void
emphasis_player_info_set(Emphasis_Player_Gui *player,
                         Emphasis_Song * song, char *msg)
{
  char *info_label;
  char *info_textblock;

  char *title, *artist, *album;
  title = artist = album = NULL;

  if (song)
    {
      char **table[] = {&(song->artist), &(song->title), &(song->album), NULL};
      emphasis_unknow_if_null(table);

      artist = etk_strescape(song->artist);
      title  = etk_strescape(song->title) ;
      album  = etk_strescape(song->album) ;

      /* TEMP */
      /* don'd remove textblocks' spaces, it's a hack (utf8) */
      if (!msg)
        {
          asprintf(&info_label,
                   "<left_margin=10>"
                   "<b><font_size=16>%s</font_size></b>"
                   "<br><br>"
                   "<font_size=11><i>by</i></font_size>  "
                   "<font_size=13>%s</font_size>  "
                   "<font_size=11><i>in</i></font_size>  "
                   "<font_size=13>%s</font_size>"
                   "</left_margin>",
                   title, artist, album);
           asprintf(&info_textblock,
                    "<b><font size=16>%s </font></b>"
                    "\n\n"
                    "<font size=11><i>by</i></font> "
                    "<font size=13>%s </font>\n"
                    "<font size=11><i>in</i></font> "
                    "<font size=13>%s </font> ",
                    title, artist, album);
        }
      else
        {
          asprintf(&info_label,
                   "<left_margin=10>"
                   "<b><font_size=16>%s</font_size></b>"
                   "<br><br>"
                   "<font_size=11><i>by</i></font_size>  "
                   "<font_size=13>%s</font_size>  "
                   "<font_size=11><i>in</i></font_size>  "
                   "<font_size=13>%s</font_size>"
                   "<font_size=11>   (%s)</font_size>"
                   "</left_margin>",
                   title, artist, album, msg);
          asprintf(&info_textblock,
                   "<b><font size=16>%s </font></b>\n"
                   "<font size=10>   (%s)</font>\n"
                   "<font size=11><i>by</i></font> "
                   "<font size=13>%s </font>\n"
                   "<font size=11><i>in</i></font> "
                   "<font size=13>%s </font>",
                   title, msg, artist, album);
        }
      
      etk_label_set(ETK_LABEL(player->full.info), info_label);
      etk_textblock_text_set(ETK_TEXT_VIEW(player->small.info)->textblock,
                             info_textblock,
                             ETK_TRUE);
      free(info_label);
      free(info_textblock);
      free(artist);
      free(title);
      free(album);
    }
  else
    {
      if (msg)
        {
          asprintf(&info_label, "%s", msg);
          asprintf(&info_textblock, "%s", msg);

          etk_label_set(ETK_LABEL(player->full.info), info_label);
          etk_textblock_text_set(ETK_TEXT_VIEW(player->small.info)->textblock,
                                 info_textblock, ETK_TRUE);

          free(info_label);
          free(info_textblock);
          
        }
    }

  etk_textblock_cursor_visible_set
   (etk_text_view_textblock_get(ETK_TEXT_VIEW(player->small.info)), ETK_FALSE);
}