Exemplo n.º 1
0
static GdaColumn *
gda_data_access_wrapper_describe_column (GdaDataModel *model, gint col)
{
	GdaDataAccessWrapper *imodel;
	g_return_val_if_fail (GDA_IS_DATA_ACCESS_WRAPPER (model), NULL);
	imodel = (GdaDataAccessWrapper*) model;
	g_return_val_if_fail (imodel->priv, NULL);

	if (imodel->priv->model) {
		if (imodel->priv->columns)
			return g_slist_nth_data (imodel->priv->columns, col);
		else
			return gda_data_model_describe_column (imodel->priv->model, col);
	}
	else
		return NULL;
}
Exemplo n.º 2
0
void vik_viewport_draw_logo ( VikViewport *vvp )
{
  g_return_if_fail ( vvp != NULL );

  guint len = g_slist_length ( vvp->logos );
  gint x = vvp->width - PAD;
  gint y = PAD;
  int i;
  for (i = 0 ; i < len ; i++)
  {
    GdkPixbuf *logo = g_slist_nth_data ( vvp->logos, i );
    gint width = gdk_pixbuf_get_width ( logo );
    gint height = gdk_pixbuf_get_height ( logo );
    vik_viewport_draw_pixbuf ( vvp, logo, 0, 0, x - width, y, width, height );
    x = x - width - PAD;
  }
}
gint riglist_get_index_from_id(gint id)
{
	gint i, len;

	g_return_val_if_fail(riglist != NULL, 0);

	len = g_slist_length(riglist);

	for (i = 0; i < len; i++) {
		struct rig_caps *rig = g_slist_nth_data(riglist, i);

		if (rig->rig_model == id)
			return i;
	}

	return 0;
}
Exemplo n.º 4
0
static void
do_ruletype_changed (struct changeRequest	*changeRequest)
{
    ruleInfoPtr		ruleInfo;
    rulePtr			rule;

    rule = g_object_get_data (G_OBJECT (changeRequest->paramHBox), "rule");
    if (rule) {
        changeRequest->editor->priv->newRules = g_slist_remove (changeRequest->editor->priv->newRules, rule);
        rule_free (rule);
    }
    ruleInfo = g_slist_nth_data (rule_get_available_rules (), changeRequest->rule);
    rule = rule_new (ruleInfo->ruleId, "", TRUE);
    changeRequest->editor->priv->newRules = g_slist_append (changeRequest->editor->priv->newRules, rule);

    rule_editor_setup_widgets (changeRequest, rule);
}
Exemplo n.º 5
0
static void cleanup_waiting_operations() {
	GSList *clean_list = NULL;
	char *key;

	if (wait_table == NULL)
		return;

	g_hash_table_foreach(wait_table, cleanup_list_waiting_list, &clean_list);


	for (int i = 0; i < g_slist_length(clean_list); i++) {
		key = g_slist_nth_data(clean_list, i);
		g_hash_table_remove(wait_table, key);
	}

	g_slist_free(clean_list);
}
Exemplo n.º 6
0
/**
 * nm_setting_vlan_remove_priority:
 * @map: the type of priority map
 * @setting: the #NMSettingVlan
 * @idx: the zero-based index of the priority map to remove
 *
 * Removes the priority map at index @idx from the
 * #NMSettingVlan:ingress_priority_map or #NMSettingVlan:egress_priority_map
 * properties.
 */
void
nm_setting_vlan_remove_priority (NMSettingVlan *setting,
                                 NMVlanPriorityMap map,
                                 guint32 idx)
{
	GSList *list = NULL, *item = NULL;

	g_return_if_fail (NM_IS_SETTING_VLAN (setting));
	g_return_if_fail (map == NM_VLAN_INGRESS_MAP || map == NM_VLAN_EGRESS_MAP);

	list = get_map (setting, map);
	g_return_if_fail (idx < g_slist_length (list));

	item = g_slist_nth_data (list, idx);
	priority_map_free ((PriorityMap *) item);
	set_map (setting, map, g_slist_delete_link (list, item));
}
Exemplo n.º 7
0
static void browsing_response(struct avctp_channel *browsing,
					struct avctp_header *avctp,
					uint8_t *operands,
					size_t operand_count)
{
	struct avctp_pending_req *p;
	struct avctp_browsing_req *req;
	struct avctp_queue *queue;
	GSList *l;

	queue = g_slist_nth_data(browsing->queues, 0);

	p = queue->p;

	if (p && p->transaction == avctp->transaction) {
		browsing->processed = g_slist_prepend(browsing->processed, p);

		if (p->timeout > 0) {
			g_source_remove(p->timeout);
			p->timeout = 0;
		}

		queue->p = NULL;

		if (queue->process_id == 0)
			queue->process_id = g_idle_add(process_queue, queue);
	}

	for (l = browsing->processed; l; l = l->next) {
		p = l->data;
		req = p->data;

		if (p->transaction != avctp->transaction)
			continue;

		if (req->func && req->func(browsing->session, operands,
						operand_count, req->user_data))
			return;

		browsing->processed = g_slist_remove(browsing->processed, p);
		pending_destroy(p, NULL);

		return;
	}
}
Exemplo n.º 8
0
static void check_deadlocks() {
	int key1, key2;
	char *sk1, *sk2;

	if (lock_waiting_list == NULL)
		return;

	GList *trans_waiting = g_hash_table_get_keys(wait_table);

	for (int i = 0; i < g_list_length(trans_waiting); i++) {
		sk1 = g_list_nth_data(trans_waiting, i);
		if (sk1 == NULL)
			continue;

		for (int j = 0; j < g_list_length(trans_waiting); j++) {
			sk2 = g_list_nth_data(trans_waiting, j);
			if (sk2 == NULL)
				continue;

			key1 = atoi(sk1);
			key2 = atoi(sk2);
			if (key1 == key2)
				continue;

			if (is_locking(key1, key2) && is_locking(key2, key1)) {
				printf("* DEADLOCK DETECTED *\n");

				// Selecionando pela operação mais velha
				sk1 = g_strdup_printf("%d", key1);
				GSList *op_list = g_hash_table_lookup(wait_table, sk1);
				g_free(sk1);

				if (g_slist_length(op_list) == 0)
					continue;

				struct operation *op = g_slist_nth_data(op_list, 0);
				if (op == NULL)
					continue;

				abort_transaction(op);
				return;
			}
		}
	}
}
Exemplo n.º 9
0
/* Get the respective driver's current samplerate. */
uint64_t srtest_get_samplerate(struct sr_dev_driver *driver)
{
	int ret;
	uint64_t samplerate;
	struct sr_dev_inst *sdi;
	GVariant *gvar;

	sdi = g_slist_nth_data(driver->priv, 0);

	ret = driver->config_get(SR_CONF_SAMPLERATE, &gvar, sdi, NULL);
	samplerate = g_variant_get_uint64(gvar);
	g_variant_unref(gvar);

	fail_unless(ret == SR_OK, "%s: Failed to get SR_CONF_SAMPLERATE: %d.",
		    driver->name, ret);

	return samplerate;
}
Exemplo n.º 10
0
const gchar *
gdict_sidebar_current_page (GdictSidebar *sidebar)
{
  GdictSidebarPrivate *priv;
  gint index;
  SidebarPage *page;
  
  g_return_val_if_fail (GDICT_IS_SIDEBAR (sidebar), NULL);

  priv = sidebar->priv;
  
  index = gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook));
  page = g_slist_nth_data (priv->pages, index);
  if (page == NULL)
    return NULL;

  return page->id;
}
Exemplo n.º 11
0
static void
insert_box_data (GogPlot *plot)
{
	GSList *list;
	GogSeries *series;
	GOData *data;
	GError *error;

	/* Create a series for the plot and populate it with some simple data */
	list = (GSList *)gog_plot_get_series (plot);
	if (g_slist_length (list) == 1)
		series = g_slist_nth_data (list, 0);
	else
		series = gog_plot_new_series (plot);

	data = go_data_vector_val_new (values, 6, NULL);
	gog_series_set_dim (series, 0, data, &error);
}
int viewer_list_item_enable_all(void)
{
	__COMMON_FUNC_ENTER__;
	assertm_if(NULL == container, "NULL!!");

	int count = g_slist_length(container);
	int i = 1;

	for(;i<count;i++){
		Elm_Object_Item* det = NULL;
		det = (Elm_Object_Item*) g_slist_nth_data(container, i);
		assertm_if(NULL == det, "NULL!!");
		elm_object_item_disabled_set(det, EINA_FALSE);
	}

	__COMMON_FUNC_EXIT__;
	return TRUE;
}
Exemplo n.º 13
0
void curlapi_http_cb(gchar *inputurl,
		     gchar *inputparams,
		     GSList *args,
		     gboolean oauth)
{
  gchar *url = g_strdup(inputurl);
  gchar *params = g_strdup(inputparams);
  struct curl_slist *oauthheader = NULL;
  CURL *curlapi = curl_easy_init();
  GString *buffer = g_string_new(NULL);
  GSList *threadargs = g_slist_copy(args);
  CURLcode returncode;

  threadargs = g_slist_prepend(threadargs, buffer);
  curl_easy_setopt(curlapi, CURLOPT_WRITEFUNCTION, curlapi_http_write_cb);
  curl_easy_setopt(curlapi, CURLOPT_WRITEDATA, threadargs);
  oauthheader = curlapi_get_oauthheader(&url, &params, oauth);
  curl_easy_setopt(curlapi, CURLOPT_URL, url);
  curl_easy_setopt(curlapi, CURLOPT_HTTPHEADER, oauthheader);
  if(params)
    curl_easy_setopt(curlapi, CURLOPT_POSTFIELDS, params);
  //curl_easy_setopt(curlapi, CURLOPT_VERBOSE, 1);
  curl_easy_setopt(curlapi, CURLOPT_FAILONERROR, 1);
  returncode = curl_easy_perform(curlapi);
  if(returncode != CURLE_OK && returncode != CURLE_WRITE_ERROR)
    {
      gchar *httperror = NULL;
      void (*write_cb)(GSList *args) = NULL;

      httperror = curlapi_http(url, params, oauth);
      threadargs = g_slist_remove(threadargs, buffer);
      write_cb = g_slist_nth_data(threadargs, 0);
      threadargs = g_slist_append(threadargs, g_strdup(httperror));
      write_cb(g_slist_nth(threadargs, 1));
      g_free(httperror);
    }

  g_free(url);
  g_free(params);
  g_string_free(buffer, TRUE);
  if(oauthheader)
    curl_slist_free_all(oauthheader);
  curl_easy_cleanup(curlapi);
}
Exemplo n.º 14
0
void media_player_set_setting(struct media_player *mp, const char *key,
							const char *value)
{
	char *curval;
	struct pending_req *p;

	DBG("%s: %s", key, value);

	if (strcasecmp(key, "Error") == 0) {
		p = g_slist_nth_data(mp->pending, 0);
		if (p == NULL)
			return;

		g_dbus_pending_property_error(p->id, ERROR_INTERFACE ".Failed",
									value);
		goto send;
	}

	curval = g_hash_table_lookup(mp->settings, key);
	if (g_strcmp0(curval, value) == 0)
		goto done;

	g_hash_table_replace(mp->settings, g_strdup(key), g_strdup(value));
	g_dbus_emit_property_changed(btd_get_dbus_connection(), mp->path,
					MEDIA_PLAYER_INTERFACE, key);

done:
	p = find_pending(mp, key);
	if (p == NULL)
		return;

	if (strcasecmp(value, p->value) == 0)
		g_dbus_pending_property_success(p->id);
	else
		g_dbus_pending_property_error(p->id,
					ERROR_INTERFACE ".NotSupported",
					"Operation is not supported");

send:
	mp->pending = g_slist_remove(mp->pending, p);
	g_free(p);

	return;
}
Exemplo n.º 15
0
static void command_set_ban(const char *data, IRC_SERVER_REC *server,
			    WI_ITEM_REC *item, int set)
{
	IRC_CHANNEL_REC *chanrec;
	char *channel, *nicks;
	void *free_arg;

	g_return_if_fail(data != NULL);
	if (server == NULL || !server->connected || !IS_IRC_SERVER(server))
		cmd_return_error(CMDERR_NOT_CONNECTED);

	if (!cmd_get_params(data, &free_arg, 2 | PARAM_FLAG_OPTCHAN | PARAM_FLAG_GETREST,
			    item, &channel, &nicks)) return;
	if (!ischannel(*channel)) cmd_param_error(CMDERR_NOT_JOINED);
	if (*nicks == '\0') {
		if (strcmp(data, "*") != 0)
			cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
                /* /BAN * or /UNBAN * - ban/unban everyone */
		nicks = (char *) data;
	}

	chanrec = irc_channel_find(server, channel);
	if (chanrec == NULL)
		cmd_param_error(CMDERR_CHAN_NOT_FOUND);
	if (!chanrec->wholist)
		cmd_param_error(CMDERR_CHAN_NOT_SYNCED);

	if (set)
		ban_set(chanrec, nicks);
	else {
		if (is_numeric(nicks, '\0')) {
			/* unban with ban number */
			BAN_REC *ban = g_slist_nth_data(chanrec->banlist,
							atoi(nicks)-1);
			if (ban != NULL)
                                nicks = ban->ban;
		}

		ban_remove(chanrec, nicks);
	}

	cmd_params_free(free_arg);
}
Exemplo n.º 16
0
/*
 * Print a GSList as char strings to a file.
 */
void
printlist(FILE *outfile, GSList *slist)
{
    guint i, j;
    guint len = g_slist_length(slist);
    char prev, cur;
    char* text;
    gboolean comment = FALSE;
    
    for(i = 0; i < len; i++) {
        prev = '\0';
        text = (char *)g_slist_nth_data(slist, i);
        
        for(j=0; (cur=text[j])!='\0'; j++, prev=cur) {
            if(comment) {
                if(prev == '*') {
                    fputc('*', outfile);
                    if(cur == '/') {
                        fputc(')', outfile);
                        comment = FALSE;
                        cur = '\0';
                        continue;
                    }
                }
                if(cur!='*')
                    fputc(cur, outfile);
            } else {
                if(prev == '/') {
                    if(cur == '*') {
                        fputs("(*", outfile);
                        comment = TRUE;
                        prev = '\0';
                        continue;
                    } else
                        fputc('/', outfile);
                }
                if(cur!='/')
                    fputc(cur, outfile);
            }
        }
        fputc('\n', outfile);
    }
}
Exemplo n.º 17
0
static int is_transaction_waiting(struct operation *op) {
	char *strtrans = g_strdup_printf("%d", op->transaction);
	struct operation *tmp_op;

	if (op == NULL)
		return 0;

	GSList *op_list = g_hash_table_lookup(wait_table, strtrans);

	if (op_list != NULL) {
		for (int i = 0; i < g_slist_length(op_list); i++) {
			tmp_op = g_slist_nth_data(op_list, i);
			if (((tmp_op->cmd == CMD_LOCK_S) || (tmp_op->cmd == CMD_LOCK_X)))
				return 1;
		}
	}

	return 0;
}
Exemplo n.º 18
0
void game_update_with_mod_proportional_imitate(game_t *game)
{
    int n = game->graph->n;
    
    int i;
    for(i = 0; i < n; ++i)
    {
        int n_i = graph_number_of_neighbours_of(game->graph, i);
        
        mpq_t *p;
        p = (mpq_t *)g_malloc(sizeof(mpq_t) * n_i);
        
        int j;
        for(j = 0; j < n_i; ++j)
        {
            mpq_init(p[j]);
        }
        
        gboolean zero_sum = game_compute_p_ij(game, i, p);
        
        if(zero_sum)
        {
            game->next_config[i] = game->current_config[i];
        }
        else
        {
            j = random_integer_with_probability(p, n_i);
            int k = GPOINTER_TO_INT(g_slist_nth_data(game->graph->edges[i], j));
            game->next_config[i] = game->current_config[k];
        }
        
        for(j = 0; j < n_i; ++j)
        {
            mpq_clear(p[j]);
        }
        g_free(p);
    }

    for(i = 0; i < n; ++i)
    {
        game->current_config[i] = game->next_config[i];
    }
}
Exemplo n.º 19
0
void
cal_replace_note_color (gchar *old_color, gchar *new_color, GUI *appGUI)
{
GSList *lnode;
struct note *a;
gint i;

	g_return_if_fail (appGUI->cal->notes_list != NULL);

	for (i = 0, lnode = appGUI->cal->notes_list; lnode != NULL; lnode = lnode->next, i++) {
		a = g_slist_nth_data (appGUI->cal->notes_list, i);

		if (a->color != NULL)
			if (!strncmp (a->color, old_color, MAXCOLORNAME)) {
				g_free (a->color);
				a->color = g_strdup (new_color);
			}
	}
}
Exemplo n.º 20
0
static DBusMessage *default_connection(DBusConnection *conn,
						DBusMessage *msg, void *data)
{
	const char *path;

	if (connection_paths == NULL ||
				g_slist_length (connection_paths) == 0)
		return does_not_exist(msg);

	path = g_slist_nth_data (connection_paths, default_index);

	if (path == NULL) {
		path = last_connection_used(conn);
		connection_store(path, TRUE);
	}

	return g_dbus_create_reply(msg, DBUS_TYPE_STRING, &path,
							DBUS_TYPE_INVALID);
}
int ssds_send_repo(ParamOptsCl* params, char *arch, char *release, int socket, int action)
{
  
  ssds_log(logDEBUG, "Client repo info JSON creating.\n");

  SsdsJsonCreate *json_gen = ssds_js_cr_init(action);
  SsdsLocalRepoInfo* local_repo = ssds_repo_parse_init();

  ssds_log(logDEBUG, "Local repo info initialized.\n");

  // parsing local repo
  if(!ssds_parse_default_repo(local_repo))
  {
     return REPO_ERROR;
  }
  ssds_log(logDEBUG, "Local repo is parsed.\n");
  
  ssds_get_repo_urls(local_repo, json_gen, arch, release);
  ssds_log(logDEBUG, "Getting repo urls.\n");
  
  ssds_log(logDEBUG, "Loop thrue required packages.\n");
  for(int i = 0; i < params->pkg_count; i++)
  {
     char* pkg = (char*)g_slist_nth_data(params->pkgs, i);
     ssds_js_cr_add_package(json_gen, pkg);
     ssds_log(logDEBUG, "Added %s package as %d in order.\n", pkg, i+1);
  }
  ssds_log(logDEBUG, "Loop is done.\n");
  
  char* repo_output;
  ssds_log(logDEBUG, "Generating output message with repo info to server.\n");
  repo_output = ssds_js_cr_to_string(json_gen);
  ssds_log(logDEBUG, "Message generated.\n\n%s\n\n", repo_output);

  /***********************************************************/
  /* Sending repo info to server                             */
  /***********************************************************/
  ssds_log(logMESSAGE, "Sending message with repo info to server.\n");
  secure_write(socket, repo_output, strlen(repo_output));
  ssds_log(logDEBUG, "Message sent.\n");

  return OK;
}
Exemplo n.º 22
0
static HRESULT STDMETHODCALLTYPE
ifiledialogevents_OnTypeChange (IFileDialogEvents * self,
                                IFileDialog *pfd)
{
  FileDialogEvents *events = (FileDialogEvents *) self;
  UINT fileType;
  HRESULT hr = IFileDialog_GetFileTypeIndex (pfd, &fileType);
  if (FAILED (hr))
    {
      g_warning_hr ("Can't get current file type", hr);
      return S_OK;
    }
  fileType--; // fileTypeIndex starts at 1 
  GSList *filters = gtk_file_chooser_list_filters (GTK_FILE_CHOOSER (events->data->self));
  events->data->self->current_filter = g_slist_nth_data (filters, fileType);
  g_slist_free (filters);
  g_object_notify (G_OBJECT (events->data->self), "filter");
  return S_OK;
}
Exemplo n.º 23
0
void wxGtkFileChooser::SetFilterIndex( int filterIndex )
{
    gpointer filter;
    GtkFileChooser *chooser = m_widget;
    GSList *filters = gtk_file_chooser_list_filters( chooser );

    filter = g_slist_nth_data( filters, filterIndex );

    if ( filter != NULL )
    {
        gtk_file_chooser_set_filter( chooser, GTK_FILE_FILTER( filter ) );
    }
    else
    {
        wxFAIL_MSG( wxT( "wxGtkFileChooser::SetFilterIndex - bad filter index" ) );
    }

    g_slist_free( filters );
}
Exemplo n.º 24
0
gint gtk_clist_set_text(GtkCList *clist, gint row, gint col, gchar *text)
{
  GtkCListRow *list_row;

  if (row < 0 || row >= clist->rows || col < 0 || col >= clist->cols)
    return -1;

  list_row = (GtkCListRow *)g_slist_nth_data(clist->rowdata, row);
  g_free(list_row->text[col]);
  list_row->text[col] = g_strdup(text);

  if (GTK_WIDGET_REALIZED(GTK_WIDGET(clist))) {
    HWND hWnd = GTK_WIDGET(clist)->hWnd;

    InvalidateRect(hWnd, NULL, FALSE);
    UpdateWindow(hWnd);
  }
  return row;
}
Exemplo n.º 25
0
Arquivo: xqf-ui.c Projeto: IR4T4/xqf
void source_ctree_delete_master (GtkWidget *ctree, struct master *m) {
	GtkCTreeNode *node;
	struct master *group;

	node = gtk_ctree_find_by_row_data (GTK_CTREE (ctree), NULL, m);
	if (!node)
		return;

	gtk_ctree_remove_node (GTK_CTREE (ctree), node);

	/* Remove empty master group from the tree */

	if (m->type != UNKNOWN_SERVER) {
		group = (struct master *) g_slist_nth_data (master_groups, m->type);
		if (group && (group->masters == NULL || (g_slist_length (group->masters) == 1 && group->masters->data == m))) {
			source_ctree_remove_master_group (ctree, group);
		}
	}
}
static void
cell_edited (GtkCellRendererText *cell,
             const gchar *path_string,
             const gchar *new_text,
             gpointer user_data)
{
	GtkBuilder *builder = GTK_BUILDER (user_data);
	GtkWidget *widget, *dialog;
	GtkListStore *store;
	GtkTreePath *path;
	GtkTreeIter iter;
	guint32 column;
	GtkTreeViewColumn *next_col;
	GtkCellRenderer *next_cell;

	/* Free auxiliary stuff */
	g_free (last_edited);
	last_edited = NULL;
	g_free (last_path);
	last_path = NULL;
	last_column = -1;

	widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip6_routes"));
	store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (widget)));
	path = gtk_tree_path_new_from_string (path_string);
	column = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (cell), "column"));

	gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path);
	gtk_list_store_set (store, &iter, column, new_text, -1);

	/* Move focus to the next column */
	column = (column >= COL_LAST) ? 0 : column + 1;
	next_col = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), column);
	dialog = GTK_WIDGET (gtk_builder_get_object (builder, "ip6_routes_dialog"));
	next_cell = g_slist_nth_data (g_object_get_data (G_OBJECT (dialog), "renderers"), column);

	gtk_tree_view_set_cursor_on_cell (GTK_TREE_VIEW (widget), path, next_col, next_cell, TRUE);

	gtk_tree_path_free (path);

	validate (dialog);
}
Exemplo n.º 27
0
/* Send an email. */
void
send_email         (gchar   *to,
                    gchar   *subject,
                    gchar   *body,
                    GSList  *attachment_list)
{
#ifdef _WIN32
  windows_send_email (to, subject, body, attachment_list);
#else

  guint attach_lenght = g_slist_length (attachment_list);
  guint i = 0;

  gchar* mailer = "xdg-email";
  gchar* subject_param = "--subject";
  gchar* body_param = "--body";
  gchar* attach_param = "--attach";

  gchar* args = g_strdup_printf("%s %s %s %s '%s'", mailer, subject_param, subject, body_param, body);

  for (i=0; i<attach_lenght; i++)
    {
      gchar* attachment = (gchar*) g_slist_nth_data (attachment_list, i);
      gchar* attachment_str = g_strdup_printf("%s '%s'", attach_param, attachment);
      gchar* new_args = g_strdup_printf("%s %s", args, attachment_str);
      g_free(args);
      args = new_args;
      g_free(attachment_str);
    }

  gchar* new_args = g_strdup_printf("%s %s&", args, to);
  g_free(args);

  if (system (new_args)<0)
    {
      g_warning("Problem running command: %s", new_args);
    }

  g_free(new_args);

#endif
}
Exemplo n.º 28
0
gboolean
check_note (guint day, guint month, guint year, GUI *appGUI) {

GSList *lnode;
struct note *a;
gint i;

    if (appGUI->cal->notes_list != NULL) {

        for (i = 0, lnode = appGUI->cal->notes_list; lnode != NULL; lnode = lnode->next, i++) {

            a = g_slist_nth_data (appGUI->cal->notes_list, i);

            if (a->day == day && a->month == month && a->year == year)
                return TRUE;
        }

    }
    return FALSE;
}
Exemplo n.º 29
0
gchar *
cal_get_note (GDate *date, GUI *appGUI)
{
GSList *lnode;
struct note *a;
gint i;

	if (appGUI->cal->notes_list != NULL) {

		for (i = 0, lnode = appGUI->cal->notes_list; lnode != NULL; lnode = lnode->next, i++) {
			a = g_slist_nth_data (appGUI->cal->notes_list, i);

			if (a->date == g_date_get_julian (date))
				return a->note;
		}

	}

    return NULL;
}
Exemplo n.º 30
0
void
cal_free_notes_list (GUI *appGUI)
{
GSList *node;
struct note *a;
gint i = 0;

	if (appGUI->cal->notes_list != NULL) {

		for (node = appGUI->cal->notes_list; node != NULL; node = node->next, i++) {
			a = g_slist_nth_data (appGUI->cal->notes_list, i);
			if (a->color != NULL) g_free (a->color);
			if (a->note != NULL) g_free (a->note);
		}

		g_slist_free (appGUI->cal->notes_list);
		appGUI->cal->notes_list = NULL;

	}
}