示例#1
0
/* main function */
int main(int argc, char **argv)
{
   // if etk init fails, print error msg to stderr
   if(!etk_init(argc, argv))
   {
      fprintf(stderr, _("Could not init Etk. Exiting...\n"));
      return 1;
   }
   // if you set --help in arguments, it will print some help information
   if(etk_argument_is_set("help", 0, ETK_FALSE))
   {
      printf(_("Usage: etk_prefs ARGUMENTS\n"));
      printf(_("ARGUMENTS:\n"));
      printf(_("   --help : print this message\n"));
      printf(_("   --theme=THEME : set theme from command line\n"));
      printf(_("   --themes-list : list themes\n"));
      return 0;
   }
   else if(etk_argument_is_set("themes-list", 0, ETK_FALSE)) // or if you will set --themes-list, it will print a list of available themes
   {
      Eina_List *themes;
      Eina_List *l;
      char *theme;
      themes = etk_theme_widget_available_themes_get();
      for(l = themes; l; l = l->next)
      {	 
	 theme = l->data;
         printf("%s\n", theme);
      }
      return 0;
   }
   
   etk_argument_value_get("theme", 0, ETK_FALSE, &_widget_theme); // if --theme argument set, it will set theme from commandline, if bad theme provided, it will print error to stderr
   if (_widget_theme)
   {
      if (etk_theme_widget_find(_widget_theme))
      {
         _etk_prefs_widget_theme = strdup(_widget_theme);   
         _etk_prefs_apply(); // apply changes
         etk_config_save(); // save them
         return 0;
      }
      else
      {
         fprintf(stderr, _("Theme %s not found. Exitting..\n"), _widget_theme); // print error message
         return 1;
      }
   }
   
   etk_prefs_show(); // show etk_prefs dialog
   
   etk_main(); // main loop
   etk_shutdown(); // shutdown etk
   
   return 0; // return success
}
示例#2
0
EtkApplication::EtkApplication( int argc, const char **argv, const char* name )
    :_name( name )
{
  // TOOD: use Exceptions
  if ( EtkApplication::_instance )
  {
    cout << "FATAL: EtkApplication object already created" << endl;
    ::exit( -1 );
  }
  cout << "EtkApplication::EtkApplication" << endl;
  if ( !etk_init( argc, const_cast<char**>(argv) ) )
  {
    cout << "FATAL: Couldn't initialize Etk" << endl;
    ::exit( -1 );
  }
  EtkApplication::_instance = this;
}
示例#3
0
Entropy_Plugin*
entropy_plugin_init (entropy_core * core)
{
  Entropy_Plugin_Gui* plugin;
  Entropy_Plugin* base;
	
  /*Init etk */
  etk_init (NULL, NULL);

  plugin = entropy_malloc(sizeof(Entropy_Plugin_Gui));
  base = ENTROPY_PLUGIN(plugin);
  
  base->functions.entropy_plugin_init = &entropy_plugin_init;
  plugin->gui_functions.layout_main = &entropy_plugin_layout_main;
  plugin->gui_functions.layout_create = &entropy_plugin_layout_create;
  plugin->gui_functions.toolkit_get= &entropy_plugin_toolkit_get;

  return base;
}
int main(int argc, char **argv)
{
  eet_init();
  enhance_init();
  etk_init(argc, argv);
   
  en = enhance_new();      

  /* Load the main window */
  enhance_file_load(en, "window", "emphasis_cover_editor.glade");
  tree  = enhance_var_get(en, "tree");
  cover  = enhance_var_get(en, "cover");
  filechooser = enhance_var_get(en, "filechooserwidget");
  filechooser_dialog  = enhance_var_get(en, "filechooser_dialog");
  add_dialog  = enhance_var_get(en, "add_dialog");
  entry_add_artist = enhance_var_get(en, "entry_add_artist");
  entry_add_album = enhance_var_get(en, "entry_add_album");

  fill_tree_with_db(ETK_TREE(tree));
   
  etk_main();
   
  return 0;
}
示例#5
0
int
main (int argc, char *argv[])
{
  Etk_Widget    *window;
  Etk_Widget    *hpaned, *vpaned;
  Etk_Widget    *tree;
  Etk_Widget    *list;
  Etk_Widget    *pdf;
  Etk_Tree_Col  *col;
  Etk_Tree_Row  *row;
  Ecore_List    *index;
  Epdf_Document *document;
  int            page_count;
  int            i;

  if (argc == 1) {
    printf ("Usage: %s pdf_file\n", argv[0]);
    return -1;
  }

  etk_init (argc, argv);

  /* We open the pdf file */
  pdf = etk_pdf_new ();
  etk_pdf_file_set (ETK_PDF (pdf), argv[1]);
  document = ETK_PDF (pdf)->pdf_document;
  if (!document) {
    printf ("The file %s can't be opened\n", argv[1]);
    etk_shutdown ();
    return -1;
  }

  window = etk_window_new ();
  etk_window_title_set (ETK_WINDOW (window), "Etk Pdf Test Application");
  etk_signal_connect ("delete-event", ETK_OBJECT (window),
                      ETK_CALLBACK(_quit_cb), NULL);

  hpaned = etk_hpaned_new();
  etk_container_add (ETK_CONTAINER (window), hpaned);
  etk_widget_show (hpaned);

  vpaned = etk_vpaned_new();
  etk_paned_child1_set (ETK_PANED (hpaned), vpaned, 0);
  etk_widget_show (vpaned);

  index = etk_pdf_pdf_index_get (ETK_PDF (pdf));
  if (index) {
    Etk_Tree_Col *col;

    tree = etk_tree_new ();
    etk_tree_mode_set (ETK_TREE (tree), ETK_TREE_MODE_TREE);
    etk_tree_multiple_select_set (ETK_TREE (tree), ETK_FALSE);

    /* column */
    col = etk_tree_col_new (ETK_TREE (tree), "Index", 130, 0.0);
    etk_tree_col_model_add (col, etk_tree_model_text_new());

    etk_tree_build (ETK_TREE (tree));

    /* rows */
    _tree_fill (ETK_PDF (pdf), ETK_TREE (tree), col, NULL, index);
    epdf_index_delete (index);

    /* change page */
    etk_signal_connect ("row-clicked", ETK_OBJECT (tree),
                        ETK_CALLBACK(_change_page_cb), pdf);

    /* we attach and show */
    etk_paned_child1_set (ETK_PANED (vpaned), tree, 0);
    etk_widget_show (tree);
  }

  list = etk_tree_new ();
  etk_tree_headers_visible_set (ETK_TREE (list), ETK_FALSE);
  etk_tree_mode_set (ETK_TREE (list), ETK_TREE_MODE_LIST);
  etk_tree_multiple_select_set (ETK_TREE (list), ETK_FALSE);

  /* column */
  col = etk_tree_col_new (ETK_TREE (list), "", 60, 0.0);
  etk_tree_col_model_add (col, etk_tree_model_int_new());

  etk_tree_build (ETK_TREE (list));

  /* rows */
  page_count = epdf_document_page_count_get (ETK_PDF (pdf)->pdf_document);
  for (i = 0; i < page_count; i++) {
    int  *num;

    row = etk_tree_row_append (ETK_TREE (list), NULL, col, i + 1, NULL);
    num = (int *)malloc (sizeof (int));
    *num = i;
    etk_tree_row_data_set_full (row, num, free);
  }

  /* change page */
  etk_signal_connect ("row-clicked", ETK_OBJECT (list),
                      ETK_CALLBACK(_change_page_cb), pdf);

  /* we attach and show */
  etk_paned_child2_set (ETK_PANED (vpaned), list, 0);
  etk_widget_show (list);

  etk_pdf_scale_set (ETK_PDF (pdf), 0.5, 0.5);
  etk_paned_child2_set (ETK_PANED (hpaned), pdf, 1);
  etk_widget_show (pdf);

  etk_widget_show (window);

  etk_main ();

  etk_shutdown ();

  return 0;
}