Esempio n. 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;
}
Esempio n. 2
0
boot_panel* bootpanel_create(main_window *win)
{
    boot_panel* pnl;
    Etk_Widget *scroll,*vbox, *hbox,*text,*frame;

    pnl = malloc(sizeof(boot_panel));
    pnl->win = win;

    vbox = etk_vbox_new(ETK_FALSE, 5);
    hbox = etk_hbox_new(ETK_FALSE, 5);

    pnl->frame = hbox;
    etk_box_append(ETK_BOX(hbox), vbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);

    scroll = etk_scrolled_view_new ();
    etk_box_append(ETK_BOX(vbox), scroll, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
    etk_widget_show(scroll);

    pnl->eth_list = etk_tree_new();
    pnl->eth_col0 = etk_tree_col_new(ETK_TREE(pnl->eth_list), _("Interfaces"), 80, 0.0);
    etk_tree_col_model_add(pnl->eth_col0, etk_tree_model_checkbox_new());
    etk_tree_col_model_add(pnl->eth_col0, etk_tree_model_text_new());

    etk_signal_connect_by_code(ETK_TREE_COL_CELL_VALUE_CHANGED_SIGNAL,
            ETK_OBJECT(pnl->eth_col0),
            ETK_CALLBACK(bootpanel_ethlist_checkbox_change_cb), pnl);

    etk_tree_mode_set(ETK_TREE(pnl->eth_list), ETK_TREE_MODE_LIST);
    etk_tree_build(ETK_TREE(pnl->eth_list));
    etk_container_add(ETK_CONTAINER(scroll), pnl->eth_list);

    text = etk_text_view_new();
    etk_widget_size_request_set(text, -1, 150);
    etk_object_properties_set(ETK_OBJECT(text), "focusable", ETK_FALSE, NULL);
    etk_textblock_text_set(ETK_TEXT_VIEW(text)->textblock,
            _("<p align=\"center\"><style effect=glow color1=#fa14 color2=#fe87><b>Help!</b></style>"
                "\n<p>When your computer boot, exalt starts and configure yours networks interfaces in the background. If you use the DHCP, your interface will get a IP address after a while.</p>"
                "\n<p>You can have a problem if you use a daemon as nfs-client. If the daemon need a network connection when it starts and your interface has no IP address, the daemon will not work. To avoid this problem Exalt can configure your interface in the foreground. If you select the interface in the list, Exalt will wait until your interface gets a IP address.</p>"
                "\n<p>If the interface doesn't get a IP address before the timeout, your computer will continue the boot process.</p>"
             ),
            ETK_TRUE);
    etk_box_append(ETK_BOX(hbox), text, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);


    frame=etk_frame_new(_("Timeout"));
    etk_box_append(ETK_BOX(vbox), frame, ETK_BOX_START, ETK_BOX_FILL, 0);

    hbox = etk_hbox_new(ETK_FALSE, 5);
    etk_container_add(ETK_CONTAINER(frame), hbox);

    pnl->slider = etk_hslider_new(1,60,30,1,5);
    etk_box_append(ETK_BOX(hbox), pnl->slider, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
    etk_slider_label_set(ETK_SLIDER(pnl->slider), "%.0f");
    etk_signal_connect_by_code(ETK_RANGE_VALUE_CHANGED_SIGNAL, ETK_OBJECT(pnl->slider), ETK_CALLBACK(bootpanel_slider_value_changed_cb), pnl);
    etk_slider_update_policy_set(ETK_SLIDER(pnl->slider), ETK_SLIDER_DELAYED);

    bootpanel_update_timeout(pnl);

    return pnl;
}
Esempio n. 3
0
/* theme preview widget */
static Etk_Widget *_etk_prefs_theme_preview_get(const char *theme)
{
   char file[PATH_MAX];
   static Etk_Widget *box = NULL;
   Etk_Widget *widget;
   Etk_Widget *vbox;
   Etk_Widget *frame;
   
   snprintf(file, sizeof(file), PACKAGE_DATA_DIR"/themes/%s.edj", theme);
   if (!ecore_file_exists(file))
   {
      char *home;
      
      home = getenv("HOME");
      if (!home)
	return NULL;
      
      snprintf(file, sizeof(file), "%s/.e/etk/themes/%s.edj", home, theme);
      if (!ecore_file_exists(file))
	return NULL;
   }
   
   free(_etk_prefs_widget_theme);
   _etk_prefs_widget_theme = strdup(theme);
   
   if (box)
   {
      etk_widget_theme_file_set(box, file);
      return box;
   }
   
   box = etk_vbox_new(ETK_FALSE, 0);   
   etk_widget_theme_file_set(box, file);
   
   frame = etk_frame_new(_("Buttons"));
   etk_box_append(ETK_BOX(box), frame, ETK_BOX_START, ETK_BOX_NONE, 0);
   vbox = etk_vbox_new(ETK_FALSE, 0);
   etk_container_add(ETK_CONTAINER(frame), vbox);
   widget = etk_button_new_with_label(_("Regular Button"));
   etk_box_append(ETK_BOX(vbox), widget, ETK_BOX_START, ETK_BOX_NONE, 0);   
   widget = etk_check_button_new_with_label(_("Check Button"));
   etk_box_append(ETK_BOX(vbox), widget, ETK_BOX_START, ETK_BOX_NONE, 0);   
   widget = etk_radio_button_new_with_label(_("Radio Button"), NULL);
   etk_box_append(ETK_BOX(vbox), widget, ETK_BOX_START, ETK_BOX_NONE, 0);   
   
   frame = etk_frame_new(_("Text"));
   etk_box_append(ETK_BOX(box), frame, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
   vbox = etk_vbox_new(ETK_FALSE, 0);
   etk_container_add(ETK_CONTAINER(frame), vbox);
   widget = etk_entry_new();
   etk_entry_text_set(ETK_ENTRY(widget), _("Sample text..."));
   etk_box_append(ETK_BOX(vbox), widget, ETK_BOX_START, ETK_BOX_NONE, 0);
   widget = etk_text_view_new();
   etk_textblock_text_set(etk_text_view_textblock_get(ETK_TEXT_VIEW(widget)),
			  _("Multi-line text widget!\nHow about that! (="),
			  ETK_TRUE);
   etk_widget_size_request_set(widget, 320, 50);
   etk_box_append(ETK_BOX(vbox), widget, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
         
   return box;
}
Esempio n. 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);
}