[monkey-bubble: 17/753] Indenting monster strikes again!
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 17/753] Indenting monster strikes again!
- Date: Wed, 14 Jul 2010 21:57:07 +0000 (UTC)
commit f6d76d656cf518933c35e5c010a61047b1986eed
Author: Arturo Espinosa <unammx src gnome org>
Date: Tue Dec 23 05:46:18 1997 +0000
Indenting monster strikes again!
Elliot, please add your name to the files you add/edit.
libgnome/gnome-history.c | 125 +++++++++++++++++++++++----------------------
libgnome/gnome-history.h | 3 +-
2 files changed, 66 insertions(+), 62 deletions(-)
---
diff --git a/libgnome/gnome-history.c b/libgnome/gnome-history.c
index 1ba49ea..d5c22c5 100644
--- a/libgnome/gnome-history.c
+++ b/libgnome/gnome-history.c
@@ -1,3 +1,8 @@
+/*
+ * Author: Elliot Lee (sopwith cuc edu)
+ *
+ * Elliot: please, stick your names to the files you create
+ */
#include <stdio.h>
#include <glib.h>
@@ -9,93 +14,91 @@
#define NUM_ENTS 10
static void write_history(GList *ents);
-static void free_history_list_entry(gpointer data,
- gpointer user_data);
+static void free_history_list_entry(gpointer data,gpointer user_data);
void
gnome_history_recently_used(GnomeHistoryEntry ent)
{
- GList *ents;
- ents = gnome_history_get_recently_used();
- ents = g_list_append(ents, ent);
- write_history(ents);
- gnome_history_free_recently_used_list(ents);
+ GList *ents;
+ ents = gnome_history_get_recently_used();
+ ents = g_list_append(ents, ent);
+ write_history(ents);
+ gnome_history_free_recently_used_list(ents);
}
GList *gnome_history_get_recently_used(void)
{
- GnomeHistoryEntry anent;
- GList *retval = NULL;
- FILE *infile;
- gchar *filename = gnome_util_home_file("document_history");
- gchar aline[512], **parts;
-
- infile = fopen(filename, "r");
- if(infile)
- {
- while(fgets(aline, sizeof(aline), infile))
- {
- gnome_chomp_string(aline, TRUE);
- if(aline[0] == '\0') continue;
-
- parts = gnome_split_string(aline, " ", 4);
-
- anent = g_malloc(sizeof(struct _GnomeHistoryEntry));
- anent->filename = parts[0];
- anent->filetype = parts[1];
- anent->creator = parts[2];
- anent->desc = parts[3];
-
- g_free(parts);
-
- retval = g_list_append(retval, anent);
+ GnomeHistoryEntry anent;
+ GList *retval = NULL;
+ FILE *infile;
+ gchar *filename = gnome_util_home_file("document_history");
+ gchar aline[512], **parts;
+
+ infile = fopen(filename, "r");
+ if(infile){
+ while(fgets(aline, sizeof(aline), infile)){
+ gnome_chomp_string(aline, TRUE);
+ if(aline[0] == '\0') continue;
+
+ parts = gnome_split_string(aline, " ", 4);
+
+ anent = g_malloc(sizeof(struct _GnomeHistoryEntry));
+ anent->filename = parts[0];
+ anent->filetype = parts[1];
+ anent->creator = parts[2];
+ anent->desc = parts[3];
+
+ g_free(parts);
+
+ retval = g_list_append(retval, anent);
+ }
+ fclose(infile);
}
- fclose(infile);
- }
- g_free(filename);
- return retval;
+ g_free(filename);
+ return retval;
}
static void
write_history_entry(GnomeHistoryEntry ent, FILE *outfile)
{
- fprintf(outfile, "%s %s %s %s\n",
- ent->filename, ent->filetype, ent->creator, ent->desc);
+ fprintf(outfile, "%s %s %s %s\n",
+ ent->filename, ent->filetype, ent->creator, ent->desc);
}
static void write_history(GList *ents)
{
- FILE *outfile;
- gchar *filename = gnome_util_home_file("document_history");
- GList *t;
- gint n;
-
- outfile = fopen(filename, "w");
- if(outfile) {
- n = g_list_length(ents) - NUM_ENTS;
- if(n < 0) n = 0;
- g_list_foreach(g_list_nth(ents, n),
- (GFunc)write_history_entry, outfile);
- }
- fclose(outfile);
- g_free(filename);
+ FILE *outfile;
+ gchar *filename = gnome_util_home_file("document_history");
+ GList *t;
+ gint n;
+
+ outfile = fopen(filename, "w");
+ if(outfile) {
+ n = g_list_length(ents) - NUM_ENTS;
+ if(n < 0) n = 0;
+ g_list_foreach(g_list_nth(ents, n),
+ (GFunc)write_history_entry, outfile);
+ }
+ fclose(outfile);
+ g_free(filename);
}
void
gnome_history_free_recently_used_list(GList *alist)
{
- g_list_foreach(alist, (GFunc) free_history_list_entry, NULL);
- g_list_free(alist);
+ g_list_foreach(alist, (GFunc) free_history_list_entry, NULL);
+ g_list_free(alist);
}
static void free_history_list_entry(gpointer data,
gpointer user_data)
{
- GnomeHistoryEntry anent;
- anent = data;
- g_free(anent->filename);
- g_free(anent->filetype);
- g_free(anent->creator);
- g_free(anent->desc);
- g_free(anent);
+ GnomeHistoryEntry anent;
+
+ anent = data;
+ g_free(anent->filename);
+ g_free(anent->filetype);
+ g_free(anent->creator);
+ g_free(anent->desc);
+ g_free(anent);
}
diff --git a/libgnome/gnome-history.h b/libgnome/gnome-history.h
index c10a3b1..6b3e612 100644
--- a/libgnome/gnome-history.h
+++ b/libgnome/gnome-history.h
@@ -4,8 +4,9 @@
BEGIN_GNOME_DECLS
struct _GnomeHistoryEntry {
- char *filename, *filetype, *creator, *desc;
+ char *filename, *filetype, *creator, *desc;
};
+
typedef struct _GnomeHistoryEntry * GnomeHistoryEntry;
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]