Exemple #1
0
gboolean
run_console_command(ConsoleUI *cui, const char *command) {
	NetContext *ctx;
	LJConsoleCommand *cc;
	int i;

	console_print(cui, NULL, _("Running command: '"));
	console_print(cui, "command", command);
	console_print(cui, NULL, "'.\n");

	cc = lj_consolecommand_new(jam_account_lj_get_user(cui->account), command);

	ctx = net_ctx_gtk_new(GTK_WINDOW(cui->win), _("Running Command"));
	if (!net_run_verb_ctx((LJVerb*)cc, ctx, NULL)) {
		console_print(cui, "error", _("Error running command.\n"));
		lj_consolecommand_free(cc);
		net_ctx_gtk_free(ctx);
		return FALSE;
	}

	for (i = 0; i < cc->linecount; i++) {
		char *typename = name_from_type(cc->lines[i].type);
		console_print(cui, typename, cc->lines[i].text);
		console_print(cui, typename, "\n");
	}

	lj_consolecommand_free(cc);
	net_ctx_gtk_free(ctx);
	
	return TRUE;
}
Exemple #2
0
gboolean 
login_run(GtkWindow *parent, JamAccountLJ *acc) {
	LJUser *u = jam_account_lj_get_user(acc);
	LJLogin *login;
	NetContext *ctx;

#ifndef G_OS_WIN32
	login = lj_login_new(u, "GTK2-LogJam/" PACKAGE_VERSION);
#else
	login = lj_login_new(u, "WinGTK2-LogJam/" PACKAGE_VERSION);
#endif

	ctx = net_ctx_gtk_new(parent, _("Logging In"));
	if (!net_run_verb_ctx((LJVerb*)login, ctx, NULL)) {
		lj_login_free(login);
		net_ctx_gtk_free(ctx);
		return FALSE;
	}

	if (login->message)
		jam_messagebox(parent, _("LiveJournal Message"), login->message);

	lj_login_free(login);
	net_ctx_gtk_free(ctx);

	acc->lastupdate = time(NULL);

	return TRUE;
}
Exemple #3
0
static gboolean
editgroup_run(friend_group_edit_dlg *fged) {
	NetContext *ctx;
	LJEditFriendGroups *efg;
	int groupid;

	if (fged->editgroup) {
		groupid = fged->editgroup->id;
	} else {
		groupid = fged->freegroup;
	}

	efg = lj_editfriendgroups_new(jam_account_lj_get_user(fged->account));
	lj_editfriendgroups_add_edit(efg, groupid,
			gtk_entry_get_text(GTK_ENTRY(fged->egroupname)),
			gtk_toggle_button_get_active(
					GTK_TOGGLE_BUTTON(fged->cpublic)));

	ctx = net_ctx_gtk_new(GTK_WINDOW(fged->win), _("Modifying Friend Group"));
	if (!net_run_verb_ctx((LJVerb*)efg, ctx, NULL)) {
		lj_editfriendgroups_free(efg);
		net_ctx_gtk_free(ctx);
		return FALSE;
	}

	if (fged->editgroup == NULL) {
		/* we must create a new group */
		fged->editgroup = lj_friendgroup_new();
		fged->editgroup->id = fged->freegroup;
	}
	string_replace(&fged->editgroup->name,
			g_strdup(gtk_entry_get_text(GTK_ENTRY(fged->egroupname))));
	fged->editgroup->ispublic =
		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fged->cpublic));

	lj_editfriendgroups_free(efg);
	net_ctx_gtk_free(ctx);
	return TRUE;
}
Exemple #4
0
static gboolean
load_tags (GtkWindow *parent, JamAccountLJ *acc, gchar *journal, GSList **l) 
{
  LJGetTags *gettags;
  NetContext *ctx;
  
  ctx = net_ctx_gtk_new (parent, _("Loading Tags"));
  gettags = lj_gettags_new (jam_account_lj_get_user (acc), journal);
  if (!net_run_verb_ctx ((LJVerb*) gettags, ctx, NULL)) 
    { 
      lj_gettags_free (gettags, TRUE);
      net_ctx_gtk_free (ctx);
      return FALSE;
    }
  
  g_hash_table_foreach (gettags->tags, (GHFunc) tags_hash_list_cb, l);
  
  lj_gettags_free (gettags, FALSE);
  net_ctx_gtk_free (ctx);
  
  return TRUE;
}
Exemple #5
0
LJEntry*
history_load_itemid(GtkWindow *parent, JamAccount *acc, const char *usejournal, int itemid) {
	NetContext *ctx;
	LJGetEventsSingle *getevents;
	LJEntry *entry;

	if (!JAM_ACCOUNT_IS_LJ(acc)) {
		g_warning("XXX blogger: history for blogger\n");
		return NULL;
	}

	getevents = lj_getevents_single_new(jam_account_lj_get_user(JAM_ACCOUNT_LJ(acc)), usejournal, itemid);
	ctx = net_ctx_gtk_new(parent, _("Loading Entry"));
	if (!net_run_verb_ctx((LJVerb*)getevents, ctx, NULL)) {
		lj_getevents_single_free(getevents, TRUE);
		net_ctx_gtk_free(ctx);
		return NULL;
	}
	entry = getevents->entry;
	lj_getevents_single_free(getevents, FALSE);
	net_ctx_gtk_free(ctx);

	return entry;
}