Exemplo n.º 1
0
static void
_get_callback(GError* error, GHashTable** entry, int count, gpointer data)
{
	(void) data;
	GVariant *val;
        int i;

	if (error) {
		g_warning("Cannot retrieve calls list: (%d) %s", error->code, error->message);
		ui_utils_error_message_from_gerror_show(VIEW_PTR(view),
			D_("Cannot retrieve calls list."), error);
		return;
	}

	for (i = 0; i < count; i++) {
		g_ptr_array_add(view.calls, entry[i]);

		val = g_hash_table_lookup(entry[i], "Peer");
		if (val) {
			_add_entry(entry[i]);
			phoneui_utils_contact_lookup(g_variant_get_string(val, NULL),
						     _contact_lookup, entry[i]);
		}
		else {
			g_message("ignoring call without Peer attribute");
		}
	}
}
Exemplo n.º 2
0
static stringList_t _volumeList( string_t ( *function )( const vInfo * ) )
{
    char * const * entry = NULL ;

    size_t entry_len = 0 ;

    stringList_t tmp ;
    stringList_t stx = StringListVoid ;
    stringList_t stl ;

    StringListIterator it  ;
    StringListIterator end ;

    string_t st = StringGetFromVirtualFile( "/proc/self/mountinfo" ) ;

    stl = StringListStringSplit( st,'\n' ) ;

    StringDelete( &st ) ;

    StringListGetIterators( stl,&it,&end ) ;

    while( it != end ) {

        tmp = StringListStringSplit( *it,' ' ) ;

        it++ ;

        stx = _add_entry( stx,tmp,function,&entry,&entry_len ) ;

        StringListDelete( &tmp ) ;
    }

    StringFree( entry ) ;

    StringListDelete( &stl ) ;

    return stx ;
}
Exemplo n.º 3
0
static void
_add_subdirs (lw6sys_context_t * sys_context, lw6sys_list_t ** entries, lw6sys_assoc_t ** entries_index, const char *absolute_path, const char *relative_path,
	      int player_exp)
{
#ifdef LW6_MS_WINDOWS
  WIN32_FIND_DATA dir_entry;
  HANDLE dir_handle = INVALID_HANDLE_VALUE;
  char *dir_wildcard = NULL;
#else // LW6_MS_WINDOWS
  struct dirent *dir_entry = NULL;
  struct dirent *dir_entry_result = NULL;
  int dir_entry_size = 0;
  DIR *dir_handle = NULL;
#endif // LW6_MS_WINDOWS
  int n = 0;
  int eod = 0;

#ifdef LW6_MS_WINDOWS
  memset (&dir_entry, 0, sizeof (WIN32_FIND_DATA));
  if (strlen (absolute_path) + 2 < MAX_PATH)
    {
      dir_wildcard = lw6sys_path_concat (sys_context, absolute_path, "*");
      if (dir_wildcard)
	{
	  dir_handle = FindFirstFile (dir_wildcard, &dir_entry);
	  LW6SYS_FREE (sys_context, dir_wildcard);
	}
    }
  if (dir_handle != INVALID_HANDLE_VALUE)
    {
      while (!eod)
	{
	  _add_entry (sys_context, entries, entries_index, absolute_path, relative_path, dir_entry.cFileName, &n, player_exp);
	  memset (&dir_entry, 0, sizeof (WIN32_FIND_DATA));
	  if (!FindNextFile (dir_handle, &dir_entry))
	    {
	      eod = 1;
	    }
	}
      FindClose (dir_handle);
    }
  else
    {
      lw6sys_log (sys_context, LW6SYS_LOG_INFO, _x_ ("no files in dir \"%s\""), absolute_path);
    }
#else // LW6_MS_WINDOWS
  dir_handle = opendir (absolute_path);
  if (dir_handle)
    {
      while (!eod)
	{
	  dir_entry_size = sizeof (struct dirent) + NAME_MAX + 1;
	  dir_entry = (struct dirent *) LW6SYS_CALLOC (sys_context, dir_entry_size);
	  if (dir_entry)
	    {
	      readdir_r (dir_handle, dir_entry, &dir_entry_result);
	      if (dir_entry_result && (dir_entry_result == dir_entry))
		{
		  _add_entry (sys_context, entries, entries_index, absolute_path, relative_path, dir_entry->d_name, &n, player_exp);
		}
	      else
		{
		  eod = 1;
		}
	      LW6SYS_FREE (sys_context, dir_entry);
	    }
	}
      if (n == 0)
	{
	  lw6sys_log (sys_context, LW6SYS_LOG_INFO, _x_ ("no maps in dir \"%s\""), absolute_path);
	}
      closedir (dir_handle);
    }
  else
    {
      lw6sys_log (sys_context, LW6SYS_LOG_WARNING, _x_ ("couldn't read map dir \"%s\""), absolute_path);
    }
#endif // LW6_MS_WINDOWS
}
Exemplo n.º 4
0
static Evas_Object *
_create_dialog (
        const gchar *username)
{
    Evas_Object *dialog, *bg, *box, *frame, *content_box;
    Evas_Object *button_frame, *pad_frame, *button_box;
    Evas_Object *cancel_button, *ok_button;

    g_free (main_dialog);
    main_dialog = g_malloc0 (sizeof (MainDialog));

    /* main window */
    dialog = elm_win_add (NULL, "dialog", ELM_WIN_BASIC);
    elm_win_title_set (dialog, "Enter user password");
    elm_win_center (dialog, EINA_TRUE, EINA_TRUE);
    evas_object_smart_callback_add (dialog, "delete,request",
            _on_close_dialog_clicked, dialog);
    main_dialog->dialog = dialog;

    /* window background */
    bg = elm_bg_add (dialog);
    evas_object_size_hint_weight_set (bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show (bg);
    elm_win_resize_object_add (dialog, bg);

    box = elm_box_add (dialog);
    evas_object_size_hint_min_set (box, 200, 200);
    evas_object_size_hint_weight_set (box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show (box);
    elm_win_resize_object_add (dialog, box);

    frame = elm_frame_add (dialog);
    elm_object_style_set (frame, "pad_small");
    evas_object_size_hint_weight_set (frame, EVAS_HINT_EXPAND,
            EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set (frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_show (frame);
    elm_box_pack_start (box, frame);

    content_box = elm_box_add (dialog);
    elm_box_padding_set (content_box, 0, 3);
    evas_object_size_hint_weight_set (content_box, EVAS_HINT_EXPAND,
            EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set (content_box, 0.0, 0.0);
    evas_object_show (content_box);
    elm_object_part_content_set (frame, NULL, content_box);

    main_dialog->username_entry = _add_entry (dialog, content_box, "Username:"******"Password:"******"outdent_bottom");
    evas_object_size_hint_weight_set (button_frame, 0.0, 0.0);
    evas_object_size_hint_align_set (button_frame, EVAS_HINT_FILL,
            EVAS_HINT_FILL);
    evas_object_show (button_frame);
    elm_box_pack_end (box, button_frame);

    pad_frame = elm_frame_add (dialog);
    elm_object_style_set (pad_frame, "pad_medium");
    evas_object_show (pad_frame);
    elm_object_part_content_set (button_frame, NULL, pad_frame);

    button_box = elm_box_add (dialog);
    elm_box_horizontal_set (button_box, 1);
    elm_box_homogeneous_set (button_box, 1);
    evas_object_show (button_box);
    elm_object_part_content_set (pad_frame, NULL, button_box);

    /* Cancel button */
    cancel_button = elm_button_add (dialog);
    elm_object_text_set (cancel_button, "Cancel");
    evas_object_size_hint_weight_set (cancel_button,
            EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set (cancel_button,
            EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_smart_callback_add (cancel_button, "clicked",
            _on_close_dialog_clicked, dialog);
    evas_object_show (cancel_button);
    elm_box_pack_end (button_box, cancel_button);

    /* OK button */
    ok_button = elm_button_add (dialog);
    elm_object_text_set (ok_button, "OK");
    evas_object_size_hint_weight_set (ok_button,
            EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set (ok_button,
            EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_smart_callback_add (ok_button, "clicked", _on_ok_dialog_clicked,
            dialog);
    evas_object_show (ok_button);
    elm_box_pack_end (button_box, ok_button);

    return dialog;
}