- Use glib wrappers for fopen/stat/chmod/unlink, fixes file operations for win32 where glib uses utf-8 for all file-handling

- win32: remove company name from exe headers as there's no company behind GKrellM
This commit is contained in:
Stefan Gehn 2008-10-28 19:02:04 +00:00
parent 5e176b0ed0
commit 3d405b9970
19 changed files with 82 additions and 122 deletions

View File

@ -24,6 +24,7 @@
#include "log.h" #include "log.h"
#include <glib.h> #include <glib.h>
#include <glib/gstdio.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -663,7 +663,7 @@ load_config(gchar *path)
//g_print("Trying to load config from file '%s'\n", path); //g_print("Trying to load config from file '%s'\n", path);
f = fopen(path, "r"); f = g_fopen(path, "r");
if (!f) if (!f)
return; return;
while (fgets(buf, sizeof(buf), f)) while (fgets(buf, sizeof(buf), f))

View File

@ -669,7 +669,7 @@ update_inet(GkrellmdMonitor *mon, gboolean first_update)
InetData *in; InetData *in;
static gint check_tcp; static gint check_tcp;
if (!first_update && !GK.second_tick) if (!first_update && !GK.second_tick)
return; return;
@ -1008,7 +1008,7 @@ update_net(GkrellmdMonitor *mon, gboolean first_update)
gkrellm_sys_net_check_routes(); gkrellm_sys_net_check_routes();
} }
gkrellm_sys_net_read_data(); gkrellm_sys_net_read_data();
if (GK.second_tick && !net_use_routed) if (GK.second_tick && !net_use_routed)
{ {
for (list = net_list; list; list = list->next) for (list = net_list; list; list = list->next)
@ -1031,7 +1031,7 @@ update_net(GkrellmdMonitor *mon, gboolean first_update)
if (net_timer->up_event) if (net_timer->up_event)
{ {
snprintf(buf, sizeof(buf), "/var/run/%s.pid", net_timer->name); snprintf(buf, sizeof(buf), "/var/run/%s.pid", net_timer->name);
if (stat(buf, &st) == 0) if (g_stat(buf, &st) == 0)
net_timer0 = st.st_mtime; net_timer0 = st.st_mtime;
else else
time(&net_timer0); time(&net_timer0);
@ -2184,7 +2184,7 @@ gkrellmd_update_monitors(void)
} }
gkrellmd_send_to_client(client, serve_gstring->str); gkrellmd_send_to_client(client, serve_gstring->str);
serve_gstring = g_string_truncate(serve_gstring, 0); serve_gstring = g_string_truncate(serve_gstring, 0);
if (GK.minute_tick || !client->served) if (GK.minute_tick || !client->served)
send_time(client); send_time(client);
else if (GK.second_tick) else if (GK.second_tick)

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="gkrellmd.exe" type="win32"/>
<description>GKrellM Daemon</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@ -20,7 +20,7 @@ BEGIN
BEGIN BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "The GKrellM Developers" VALUE "CompanyName", ""
VALUE "FileDescription", "GKrellM Daemon" VALUE "FileDescription", "GKrellM Daemon"
VALUE "FileVersion", "2.3.2" VALUE "FileVersion", "2.3.2"
VALUE "InternalName", "gkrellmd" VALUE "InternalName", "gkrellmd"
@ -35,10 +35,3 @@ BEGIN
VALUE "Translation", 1033, 1200 VALUE "Translation", 1033, 1200
END END
END END
//
// Manifest resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
1 RT_MANIFEST "win32-manifest.xml"

View File

@ -120,7 +120,7 @@ gkrellm_log_set_filename(const gchar* filename)
if (filename && filename[0] != '\0') if (filename && filename[0] != '\0')
{ {
// Open the file to log into // Open the file to log into
s_gkrellm_logfile = fopen(filename, "at"); s_gkrellm_logfile = g_fopen(filename, "at");
// Add our callbacks to logging chain // Add our callbacks to logging chain
if (s_gkrellm_logfile) if (s_gkrellm_logfile)
{ {

View File

@ -168,9 +168,9 @@ gkrellm_theme_file_exists(char *name, gchar *subdir)
path = g_strdup_printf("%s/%s_%d%s", _GK.theme_path, path = g_strdup_printf("%s/%s_%d%s", _GK.theme_path,
name, _GK.theme_alternative, image_type[i]); name, _GK.theme_alternative, image_type[i]);
#ifdef WIN32 #ifdef WIN32
if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) if (g_stat(path, &st) == 0 && S_ISREG(st.st_mode))
#else #else
if ( stat(path, &st) == 0 if ( g_stat(path, &st) == 0
&& (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) && (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode))
) )
#endif #endif
@ -188,9 +188,9 @@ gkrellm_theme_file_exists(char *name, gchar *subdir)
path = g_strdup_printf("%s/%s%s", _GK.theme_path, name, path = g_strdup_printf("%s/%s%s", _GK.theme_path, name,
image_type[i]); image_type[i]);
#ifdef WIN32 #ifdef WIN32
if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) if (g_stat(path, &st) == 0 && S_ISREG(st.st_mode))
#else #else
if ( stat(path, &st) == 0 if ( g_stat(path, &st) == 0
&& (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) && (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode))
) )
#endif #endif
@ -2202,7 +2202,7 @@ parse_gkrellmrc(gint alternative)
if (alternative > 0) if (alternative > 0)
snprintf(lbuf, sizeof(lbuf), "_%d", alternative); snprintf(lbuf, sizeof(lbuf), "_%d", alternative);
path = g_strdup_printf("%s/%s%s", _GK.theme_path, GKRELLMRC, lbuf); path = g_strdup_printf("%s/%s%s", _GK.theme_path, GKRELLMRC, lbuf);
if ((f = fopen(path, "r")) != NULL) if ((f = g_fopen(path, "r")) != NULL)
{ {
while (fgets(buf, sizeof(buf), f)) while (fgets(buf, sizeof(buf), f))
{ {
@ -2311,7 +2311,7 @@ gkrellm_load_user_config(GkrellmMonitor *mon_only, gboolean monitor_values)
} }
config = gkrellm_make_config_file_name(gkrellm_homedir(), config = gkrellm_make_config_file_name(gkrellm_homedir(),
GKRELLM_USER_CONFIG); GKRELLM_USER_CONFIG);
f = fopen(config, "r"); f = g_fopen(config, "r");
g_free(config); g_free(config);
if (f) if (f)
@ -2432,7 +2432,7 @@ gkrellm_save_user_config(void)
GKRELLM_USER_CONFIG); GKRELLM_USER_CONFIG);
config_new = g_strconcat(config, ".new", NULL); config_new = g_strconcat(config, ".new", NULL);
f = fopen(config_new, "w"); f = g_fopen(config_new, "w");
if (f == NULL) if (f == NULL)
{ {
g_warning(_("Cannot open config file %s for writing.\n"), config_new); g_warning(_("Cannot open config file %s for writing.\n"), config_new);
@ -2467,7 +2467,7 @@ gkrellm_save_user_config(void)
} }
if ( !_GK.config_clean if ( !_GK.config_clean
&& (ff = fopen(config, "r")) != NULL && (ff = g_fopen(config, "r")) != NULL
) )
{ {
gchar buf[CFG_BUFSIZE], *keyword, *ch, tmp; gchar buf[CFG_BUFSIZE], *keyword, *ch, tmp;
@ -2516,9 +2516,9 @@ gkrellm_save_user_config(void)
fclose(f); fclose(f);
#if defined(WIN32) #if defined(WIN32)
/* windows rename() does not allow overwriting existing files! */ /* windows rename() does not allow overwriting existing files! */
unlink(config); g_unlink(config);
#endif #endif
i = rename(config_new, config); i = g_rename(config_new, config);
if (i != 0) if (i != 0)
{ {
g_warning("Cannot rename new config file %s to %s.\n", config_new, config); g_warning("Cannot rename new config file %s to %s.\n", config_new, config);
@ -2535,7 +2535,7 @@ gkrellm_save_user_config(void)
#else #else
mode = 0600; mode = 0600;
#endif #endif
chmod(config, mode); g_chmod(config, mode);
g_free(config); g_free(config);
g_free(config_new); g_free(config_new);

View File

@ -1354,7 +1354,7 @@ fstab_user_permission(Mount *m)
{ {
struct stat my_stat; struct stat my_stat;
stat(m->device, &my_stat); g_stat(m->device, &my_stat);
if ( strstr(m->options, "user") if ( strstr(m->options, "user")
|| (strstr(m->options, "owner") && my_stat.st_uid == uid) || (strstr(m->options, "owner") && my_stat.st_uid == uid)
) )

View File

@ -45,6 +45,7 @@
#endif #endif
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <glib/gstdio.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1140,7 +1140,7 @@ _("Make gkrellm a topmost window (restart gkrellm for this to take effect)."));
vbox2 = gkrellm_gtk_framed_vbox(vbox1, NULL, 0, FALSE, 0, 0); vbox2 = gkrellm_gtk_framed_vbox(vbox1, NULL, 0, FALSE, 0, 0);
gkrellm_gtk_check_button_connected(vbox2, &dock_type_button, gkrellm_gtk_check_button_connected(vbox2, &dock_type_button,
_GK.dock_type, FALSE, FALSE, 0, _GK.dock_type, FALSE, FALSE, 0,
cb_dock_type, NULL, cb_dock_type, NULL,
_("Set window type to be a dock or panel")); _("Set window type to be a dock or panel"));
vbox2 = gkrellm_gtk_framed_vbox(vbox1, NULL, 0, FALSE, 0, 0); vbox2 = gkrellm_gtk_framed_vbox(vbox1, NULL, 0, FALSE, 0, 0);
@ -1314,7 +1314,7 @@ get_theme_author(gchar *path)
if (!path || *path == '\0') if (!path || *path == '\0')
return buf; return buf;
rcfile = g_strdup_printf("%s/%s", path, GKRELLMRC); rcfile = g_strdup_printf("%s/%s", path, GKRELLMRC);
f = fopen(rcfile, "r"); f = g_fopen(rcfile, "r");
g_free(rcfile); g_free(rcfile);
if (!f) if (!f)
return buf; return buf;
@ -1570,7 +1570,7 @@ gkrellm_save_theme_config(void)
path = gkrellm_make_config_file_name(gkrellm_homedir(), path = gkrellm_make_config_file_name(gkrellm_homedir(),
GKRELLM_THEME_CONFIG); GKRELLM_THEME_CONFIG);
if ((f = fopen(path, "w")) != NULL) if ((f = g_fopen(path, "w")) != NULL)
{ {
fprintf(f, "%s\n", _GK.theme_path); fprintf(f, "%s\n", _GK.theme_path);
fprintf(f, "%d\n", _GK.theme_alternative); fprintf(f, "%d\n", _GK.theme_alternative);
@ -1593,7 +1593,7 @@ gkrellm_load_theme_config(void)
gint i; gint i;
/* Need to load the theme from ~/.gkrellm/theme_config only at startup /* Need to load the theme from ~/.gkrellm/theme_config only at startup
| or if re-reading because of theme_event - these are only times | or if re-reading because of theme_event - these are only times
| _GK.theme_path will be NULL. Note: _GK.theme_path will not be NULL | _GK.theme_path will be NULL. Note: _GK.theme_path will not be NULL
| at startup if there is a command line theme, so no theme scaling if | at startup if there is a command line theme, so no theme scaling if
| using command line theme. | using command line theme.
@ -1602,7 +1602,7 @@ gkrellm_load_theme_config(void)
{ {
path = gkrellm_make_config_file_name(gkrellm_homedir(), path = gkrellm_make_config_file_name(gkrellm_homedir(),
GKRELLM_THEME_CONFIG); GKRELLM_THEME_CONFIG);
f = fopen(path, "r"); f = g_fopen(path, "r");
g_free(path); g_free(path);
if (f && fgets(buf, sizeof(buf), f)) if (f && fgets(buf, sizeof(buf), f))
{ {
@ -2277,7 +2277,7 @@ create_config_window(void)
GList *list; GList *list;
GkrellmMonitor *mon; GkrellmMonitor *mon;
gchar *config_name, *window_title; gchar *config_name, *window_title;
if (config_window) if (config_window)
{ {
gtk_window_present(GTK_WINDOW(config_window)); gtk_window_present(GTK_WINDOW(config_window));
@ -2298,7 +2298,7 @@ create_config_window(void)
gtk_window_set_wmclass(GTK_WINDOW(config_window), gtk_window_set_wmclass(GTK_WINDOW(config_window),
"Gkrellm_conf", "Gkrellm"); "Gkrellm_conf", "Gkrellm");
gtk_container_set_border_width(GTK_CONTAINER(config_window), 2); gtk_container_set_border_width(GTK_CONTAINER(config_window), 2);
config_hbox = gtk_hbox_new(FALSE, 4); config_hbox = gtk_hbox_new(FALSE, 4);
gtk_container_add(GTK_CONTAINER(config_window), config_hbox); gtk_container_add(GTK_CONTAINER(config_window), config_hbox);

View File

@ -1323,7 +1323,7 @@ gkrellm_inet_save_data(void)
{ {
in = (InetMon *) list->data; in = (InetMon *) list->data;
fname = make_inet_data_fname(in); fname = make_inet_data_fname(in);
if ((f = fopen(fname, "w")) == NULL) if ((f = g_fopen(fname, "w")) == NULL)
continue; continue;
fputs("minute hour yday width\n", f); fputs("minute hour yday width\n", f);
@ -1357,7 +1357,7 @@ gkrellm_inet_load_data(void)
{ {
in = (InetMon *) list->data; in = (InetMon *) list->data;
fname = make_inet_data_fname(in); fname = make_inet_data_fname(in);
if ((f = fopen(fname, "r")) == NULL) if ((f = g_fopen(fname, "r")) == NULL)
{ {
gkrellm_reset_chart(in->chart); gkrellm_reset_chart(in->chart);
draw_inet_chart(in); draw_inet_chart(in);

View File

@ -115,7 +115,7 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
/* Here's the list of all the mailbox types the Mail monitor knows about. /* Here's the list of all the mailbox types the Mail monitor knows about.
| The MBOX_FETCH is a pseudo internal mailbox where the counts read from | The MBOX_FETCH is a pseudo internal mailbox where the counts read from
| the fetch program are kept. Additionally MBOX_FETCH_TOOLTIP types | the fetch program are kept. Additionally MBOX_FETCH_TOOLTIP types
| are constructed just so the fetch programs output lines can be | are constructed just so the fetch programs output lines can be
| reported in a tooltip. Real mailboxes that GKrellM creates in its | reported in a tooltip. Real mailboxes that GKrellM creates in its
| config and knows how to check have MBOX_INTERNAL set. And | config and knows how to check have MBOX_INTERNAL set. And
| finally there can be external (plugin) mailboxes created which | finally there can be external (plugin) mailboxes created which
@ -390,7 +390,7 @@ update_tooltip(void)
MailAccount *account; MailAccount *account;
GString *mboxes = NULL; GString *mboxes = NULL;
gchar buf[128]; gchar buf[128];
if (show_tooltip) if (show_tooltip)
{ {
mboxes = g_string_sized_new(512); mboxes = g_string_sized_new(512);
@ -412,10 +412,10 @@ update_tooltip(void)
else if (! format_remote_mbox_name(mbox, buf, sizeof(buf))) else if (! format_remote_mbox_name(mbox, buf, sizeof(buf)))
continue; /* Can't get a name, so no tooltip for you! */ continue; /* Can't get a name, so no tooltip for you! */
if (mboxes->len > 0) if (mboxes->len > 0)
g_string_append_c(mboxes, '\n'); g_string_append_c(mboxes, '\n');
g_string_append(mboxes, buf); g_string_append(mboxes, buf);
if (count_mode == MSG_NEW_TOTAL_COUNT) if (count_mode == MSG_NEW_TOTAL_COUNT)
snprintf(buf, sizeof(buf), "(%d/%d)", snprintf(buf, sizeof(buf), "(%d/%d)",
mbox->new_mail_count, mbox->mail_count); mbox->new_mail_count, mbox->mail_count);
@ -429,7 +429,7 @@ update_tooltip(void)
if (show_tooltip && mboxes && mboxes->len > 0) if (show_tooltip && mboxes && mboxes->len > 0)
{ {
#if GTK_CHECK_VERSION(2,12,0) #if GTK_CHECK_VERSION(2,12,0)
gtk_widget_set_tooltip_text(mail->drawing_area, mboxes->str); gtk_widget_set_tooltip_text(mail->drawing_area, mboxes->str);
#else #else
gtk_tooltips_set_tip(tooltip, mail->drawing_area, mboxes->str, ""); gtk_tooltips_set_tip(tooltip, mail->drawing_area, mboxes->str, "");
gtk_tooltips_enable(tooltip); gtk_tooltips_enable(tooltip);
@ -447,8 +447,8 @@ update_tooltip(void)
if (mboxes) if (mboxes)
g_string_free(mboxes, TRUE); g_string_free(mboxes, TRUE);
} }
/* Look at a From line to see if it is valid, lines look like: /* Look at a From line to see if it is valid, lines look like:
| From sending_address dayofweek month dayofmonth timeofday year | From sending_address dayofweek month dayofmonth timeofday year
| eg: From billw@gkrellm.net Fri Oct 22 13:52:49 2010 | eg: From billw@gkrellm.net Fri Oct 22 13:52:49 2010
@ -490,7 +490,7 @@ is_multipart_mail(gchar *buf, gchar *separator)
gchar *fieldstart; gchar *fieldstart;
gchar *sepstart; gchar *sepstart;
gint seplen; gint seplen;
if (strncmp(buf, "Content-Type: ", 14) != 0) if (strncmp(buf, "Content-Type: ", 14) != 0)
return FALSE; return FALSE;
if (strncmp(&buf[14], "multipart/", 10) != 0) if (strncmp(&buf[14], "multipart/", 10) != 0)
@ -1228,7 +1228,7 @@ check_imap(Mailbox *mbox)
return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE); return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE);
if ((ss = strstr(mbox->tcp_in->str, "MESSAGES")) == NULL) if ((ss = strstr(mbox->tcp_in->str, "MESSAGES")) == NULL)
return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE); return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE);
} }
else else
return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE); return tcp_shutdown(&conn, mbox, tcp_error_message[4], FALSE);
} }
@ -1263,7 +1263,7 @@ mh_sequences_new_count(Mailbox *mbox)
path = g_strconcat(mbox->account->path, G_DIR_SEPARATOR_S, path = g_strconcat(mbox->account->path, G_DIR_SEPARATOR_S,
".mh_sequences", NULL); ".mh_sequences", NULL);
f = fopen(path, "r"); f = g_fopen(path, "r");
g_free(path); g_free(path);
if (!f) if (!f)
return FALSE; return FALSE;
@ -1315,7 +1315,7 @@ sylpheed_mark_new_count(Mailbox *mbox)
for (fname = mark_file_names; *fname; fname++) { for (fname = mark_file_names; *fname; fname++) {
path = g_strconcat(mbox->account->path, G_DIR_SEPARATOR_S, path = g_strconcat(mbox->account->path, G_DIR_SEPARATOR_S,
*fname, NULL); *fname, NULL);
f = fopen(path, "rb"); f = g_fopen(path, "rb");
g_free(path); g_free(path);
if (f) if (f)
break; break;
@ -1323,7 +1323,7 @@ sylpheed_mark_new_count(Mailbox *mbox)
if (!f) if (!f)
return FALSE; return FALSE;
if ( fread(&ver, sizeof(ver), 1, f) == 1 if ( fread(&ver, sizeof(ver), 1, f) == 1
&& SYLPHEED_MARK_VERSION == ver && SYLPHEED_MARK_VERSION == ver
) )
@ -1448,12 +1448,12 @@ check_maildir(Mailbox *mbox)
| And Netscape mail does status with X-Mozilla-Status: xxxS | And Netscape mail does status with X-Mozilla-Status: xxxS
| where S is bitwise or of status flags: | where S is bitwise or of status flags:
| 1: read 2: replied 4: marked 8: deleted | 1: read 2: replied 4: marked 8: deleted
| |
| Evolution uses status with X-Evolution: 00000000-xxxx where xxxx status is | Evolution uses status with X-Evolution: 00000000-xxxx where xxxx status is
| a bitfield in hexadecimal (see enum _CamelMessageFlags in evolution/camel | a bitfield in hexadecimal (see enum _CamelMessageFlags in evolution/camel
| source) and most importantly CAMEL_MESSAGE_SEEN = 1<<4. | source) and most importantly CAMEL_MESSAGE_SEEN = 1<<4.
*/ */
/* test if buf is a status for standard mail, mozilla or evolution /* test if buf is a status for standard mail, mozilla or evolution
*/ */
static gboolean static gboolean
is_status(gchar *buf) is_status(gchar *buf)
@ -1505,7 +1505,7 @@ status_is_old(gchar *buf)
return FALSE; return FALSE;
} }
/* test if a mail is marked as deleted /* test if a mail is marked as deleted
| Evolution uses status with X-Evolution: 00000000-xxxx where xxxx status is | Evolution uses status with X-Evolution: 00000000-xxxx where xxxx status is
| a bitfield in hexadecimal (see enum _CamelMessageFlags in evolution/camel source) | a bitfield in hexadecimal (see enum _CamelMessageFlags in evolution/camel source)
| and most importantly CAMEL_MESSAGE_DELETED = 1<<1. | and most importantly CAMEL_MESSAGE_DELETED = 1<<1.
@ -1551,7 +1551,7 @@ check_mbox(Mailbox *mbox)
gint is_multipart = FALSE; gint is_multipart = FALSE;
gint content_len = 0; gint content_len = 0;
if (stat(mbox->account->path, &s) != 0) if (g_stat(mbox->account->path, &s) != 0)
{ {
mbox->mail_count = mbox->old_mail_count = mbox->new_mail_count = 0; mbox->mail_count = mbox->old_mail_count = mbox->new_mail_count = 0;
mbox->last_mtime = 0; mbox->last_mtime = 0;
@ -1589,7 +1589,7 @@ check_mbox(Mailbox *mbox)
|| force_mail_check || force_mail_check
) )
{ {
if ((f = fopen(mbox->account->path, "r")) == NULL) if ((f = g_fopen(mbox->account->path, "r")) == NULL)
{ {
if (_GK.debug_level & DEBUG_MAIL) if (_GK.debug_level & DEBUG_MAIL)
printf("check_mbox can't fopen(%s): %s\n", mbox->account->path, printf("check_mbox can't fopen(%s): %s\n", mbox->account->path,
@ -1751,7 +1751,7 @@ draw_mail_text_decal(gint new_mail_count, gint mail_count)
strcpy(tbuf, "-"); strcpy(tbuf, "-");
else else
snprintf(tbuf, sizeof(tbuf), "%d", mail_count); snprintf(tbuf, sizeof(tbuf), "%d", mail_count);
snprintf(buf, sizeof(buf), "%s/%s", nbuf, tbuf); snprintf(buf, sizeof(buf), "%s/%s", nbuf, tbuf);
} }
} }
w = gkrellm_gdk_string_width(ts.font, buf); w = gkrellm_gdk_string_width(ts.font, buf);
@ -2249,7 +2249,7 @@ update_mail(void)
if (GK.second_tick && (++second_count % local_check_timeout) == 0) if (GK.second_tick && (++second_count % local_check_timeout) == 0)
local_check = TRUE; local_check = TRUE;
fetch_check = fetch_check_is_local ? local_check : remote_check; fetch_check = fetch_check_is_local ? local_check : remote_check;
if (remote_check || local_check) if (remote_check || local_check)
mua_is_launched(); /* update pipe, avoid lingering zombie */ mua_is_launched(); /* update pipe, avoid lingering zombie */
@ -2283,7 +2283,7 @@ update_mail(void)
if (fetch_check) if (fetch_check)
(*mbox->check_func)(mbox); (*mbox->check_func)(mbox);
break; break;
case MBOX_CHECK_INLINE: /* Local mailbox or maildir check */ case MBOX_CHECK_INLINE: /* Local mailbox or maildir check */
if (local_check) if (local_check)
{ {
@ -2525,7 +2525,7 @@ cb_panel_press(GtkWidget *widget, GdkEventButton *ev)
if (ev->button == 1 && ev->x >= d->x && ev->x < d->x + d->w) if (ev->button == 1 && ev->x >= d->x && ev->x < d->x + d->w)
force_mail_check = TRUE; force_mail_check = TRUE;
return FALSE; return FALSE;
} }
static void static void
dup_account(MailAccount *dst, MailAccount *src) dup_account(MailAccount *dst, MailAccount *src)
@ -3361,7 +3361,7 @@ cb_tree_selection_changed(GtkTreeSelection *selection, gpointer data)
active = (account->port == default_port) ? FALSE : TRUE; active = (account->port == default_port) ? FALSE : TRUE;
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(port_button), active); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(port_button), active);
sprintf(buf, "%d", account->port); sprintf(buf, "%d", account->port);
gtk_entry_set_text(GTK_ENTRY(port_entry), buf); gtk_entry_set_text(GTK_ENTRY(port_entry), buf);
} }
else if (local_supported) else if (local_supported)
{ {
@ -3950,7 +3950,7 @@ create_mail_tab(GtkWidget *tab_vbox)
gtk_box_pack_start(GTK_BOX(hbox), mbox_path_entry, TRUE, TRUE, 2); gtk_box_pack_start(GTK_BOX(hbox), mbox_path_entry, TRUE, TRUE, 2);
gtk_entry_set_text(GTK_ENTRY(mbox_path_entry), ""); gtk_entry_set_text(GTK_ENTRY(mbox_path_entry), "");
g_signal_connect (G_OBJECT (mbox_path_entry), "activate", g_signal_connect (G_OBJECT (mbox_path_entry), "activate",
G_CALLBACK(mailbox_enter_cb), NULL); G_CALLBACK(mailbox_enter_cb), NULL);
} }
/* Remote mailbox account entry */ /* Remote mailbox account entry */
@ -4200,7 +4200,7 @@ create_mail_tab(GtkWidget *tab_vbox)
mh_seq_ignore, TRUE, TRUE, 0, mh_seq_ignore, TRUE, TRUE, 0,
multi_toggle_button_cb, NULL, multi_toggle_button_cb, NULL,
_("Ignore .mh_sequences when checking MH mail.")); _("Ignore .mh_sequences when checking MH mail."));
/* --Info tab */ /* --Info tab */
vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Info")); vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Info"));
text = gkrellm_gtk_scrolled_text_view(vbox, NULL, text = gkrellm_gtk_scrolled_text_view(vbox, NULL,

View File

@ -279,7 +279,7 @@ set_or_save_position(gint save)
} }
if ( !_GK.no_config if ( !_GK.no_config
&& (_GK.x_position != x_last || _GK.y_position != y_last) && (_GK.x_position != x_last || _GK.y_position != y_last)
&& (f = fopen(path, "w")) != NULL && (f = g_fopen(path, "w")) != NULL
) )
{ {
x_last = _GK.x_position; x_last = _GK.x_position;
@ -292,7 +292,7 @@ set_or_save_position(gint save)
} }
else if (!_GK.withdrawn) /* In slit conflicts with setting position */ else if (!_GK.withdrawn) /* In slit conflicts with setting position */
{ {
if ((f = fopen(path, "r")) != NULL) if ((f = g_fopen(path, "r")) != NULL)
{ {
x = y = 0; x = y = 0;
fscanf(f, "%d %d", &x, &y); fscanf(f, "%d %d", &x, &y);

View File

@ -781,7 +781,7 @@ get_connect_state(void)
{ {
snprintf(buf, sizeof(buf), snprintf(buf, sizeof(buf),
"%s/%s", lock_directory, PPP_LOCK_FILE); "%s/%s", lock_directory, PPP_LOCK_FILE);
if (stat(buf, &st) == 0) if (g_stat(buf, &st) == 0)
state = TB_STANDBY; state = TB_STANDBY;
else else
{ {
@ -790,7 +790,7 @@ get_connect_state(void)
*/ */
snprintf(buf, sizeof(buf), "%s/%s/%s", snprintf(buf, sizeof(buf), "%s/%s/%s",
gkrellm_homedir(), GKRELLM_DIR, PPP_LOCK_FILE); gkrellm_homedir(), GKRELLM_DIR, PPP_LOCK_FILE);
if (stat(buf, &st) == 0) if (g_stat(buf, &st) == 0)
state = TB_STANDBY; state = TB_STANDBY;
} }
} }
@ -821,7 +821,7 @@ get_connect_time(void)
break; break;
case TIMER_TYPE_PPP: case TIMER_TYPE_PPP:
snprintf(buf, sizeof(buf), "/var/run/%s.pid", timer_button_iface); snprintf(buf, sizeof(buf), "/var/run/%s.pid", timer_button_iface);
if (stat(buf, &st) == 0) if (g_stat(buf, &st) == 0)
t = st.st_mtime; t = st.st_mtime;
break; break;
case TIMER_TYPE_IPPP: case TIMER_TYPE_IPPP:
@ -917,7 +917,7 @@ stale_pppd_files_debug(void)
gchar buf[256]; gchar buf[256];
snprintf(buf, sizeof(buf), "/var/run/%s.pid", timer_button_iface); snprintf(buf, sizeof(buf), "/var/run/%s.pid", timer_button_iface);
if (stat(buf, &st) == 0 && !net_timed->up) if (g_stat(buf, &st) == 0 && !net_timed->up)
g_print(_(" **** Stale pppd pppX.pid file detected!\n")); g_print(_(" **** Stale pppd pppX.pid file detected!\n"));
} }
@ -1672,7 +1672,7 @@ gkrellm_net_save_data(void)
continue; continue;
snprintf(fname, sizeof(fname), "%s%c%s", net_data_dir, snprintf(fname, sizeof(fname), "%s%c%s", net_data_dir,
G_DIR_SEPARATOR, net->name); G_DIR_SEPARATOR, net->name);
if ((f = fopen(fname, "w")) == NULL) if ((f = g_fopen(fname, "w")) == NULL)
continue; continue;
fprintf(f, "%d\n", NET_DATA_VERSION); fprintf(f, "%d\n", NET_DATA_VERSION);
fputs("wday mday month yday year\n", f); fputs("wday mday month yday year\n", f);
@ -1822,7 +1822,7 @@ load_net_data(void)
net = (NetMon *) list->data; net = (NetMon *) list->data;
snprintf(fname, sizeof(fname), "%s%c%s", net_data_dir, snprintf(fname, sizeof(fname), "%s%c%s", net_data_dir,
G_DIR_SEPARATOR, net->name); G_DIR_SEPARATOR, net->name);
if ((f = fopen(fname, "r")) == NULL) if ((f = g_fopen(fname, "r")) == NULL)
continue; continue;
fgets(buf, sizeof(buf), f); fgets(buf, sizeof(buf), f);
if (sscanf(buf, "%d\n", &version) != 1) if (sscanf(buf, "%d\n", &version) != 1)

View File

@ -1050,7 +1050,7 @@ load_plugins_placement_file(void)
gkrellm_free_glist_and_data(&plugins_place_list); gkrellm_free_glist_and_data(&plugins_place_list);
path = gkrellm_make_config_file_name(gkrellm_homedir(), path = gkrellm_make_config_file_name(gkrellm_homedir(),
PLUGIN_PLACEMENT_FILE); PLUGIN_PLACEMENT_FILE);
if ((f = fopen(path, "r")) != NULL) if ((f = g_fopen(path, "r")) != NULL)
{ {
while ((fgets(buf, sizeof(buf), f)) != NULL) while ((fgets(buf, sizeof(buf), f)) != NULL)
{ {
@ -1072,12 +1072,12 @@ save_plugins_placement_file(void)
GkrellmMonitor *builtin, *plugin; GkrellmMonitor *builtin, *plugin;
GkrellmMonprivate *mp; GkrellmMonprivate *mp;
gchar *path; gchar *path;
if (!plugin_placement_modified || _GK.demo || _GK.no_config) if (!plugin_placement_modified || _GK.demo || _GK.no_config)
return; return;
path = gkrellm_make_config_file_name(gkrellm_homedir(), path = gkrellm_make_config_file_name(gkrellm_homedir(),
PLUGIN_PLACEMENT_FILE); PLUGIN_PLACEMENT_FILE);
if ((f = fopen(path, "w")) != NULL) if ((f = g_fopen(path, "w")) != NULL)
{ {
for (list = plugins_list; list; list = list->next) for (list = plugins_list; list; list = list->next)
{ {
@ -1111,7 +1111,7 @@ load_plugins_enable_file(void)
gkrellm_free_glist_and_data(&plugins_enable_list); gkrellm_free_glist_and_data(&plugins_enable_list);
path = gkrellm_make_config_file_name(gkrellm_homedir(),PLUGIN_ENABLE_FILE); path = gkrellm_make_config_file_name(gkrellm_homedir(),PLUGIN_ENABLE_FILE);
if ((f = fopen(path, "r")) != NULL) if ((f = g_fopen(path, "r")) != NULL)
{ {
while ((fgets(buf, sizeof(buf), f)) != NULL) while ((fgets(buf, sizeof(buf), f)) != NULL)
{ {
@ -1134,12 +1134,12 @@ save_plugins_enable_file(void)
GList *list; GList *list;
GkrellmMonitor *m; GkrellmMonitor *m;
gchar *path, *s; gchar *path, *s;
if (!plugin_enable_list_modified || _GK.demo) if (!plugin_enable_list_modified || _GK.demo)
return; return;
path = gkrellm_make_config_file_name(gkrellm_homedir(), path = gkrellm_make_config_file_name(gkrellm_homedir(),
PLUGIN_ENABLE_FILE); PLUGIN_ENABLE_FILE);
if ((f = fopen(path, "w")) != NULL) if ((f = g_fopen(path, "w")) != NULL)
{ {
for (list = plugins_list; list; list = list->next) for (list = plugins_list; list; list = list->next)
{ {
@ -1177,7 +1177,7 @@ scan_for_plugins(gchar *path)
GkrellmMonitor *m = NULL; GkrellmMonitor *m = NULL;
gchar *s; gchar *s;
gboolean exists; gboolean exists;
if (!path || !*path || (dir = g_dir_open(path, 0, NULL)) == NULL) if (!path || !*path || (dir = g_dir_open(path, 0, NULL)) == NULL)
return; return;
while ((name = (gchar *) g_dir_read_name(dir)) != NULL) while ((name = (gchar *) g_dir_read_name(dir)) != NULL)

View File

@ -375,7 +375,7 @@ gkrellm_sensor_draw_temperature_decal(GkrellmPanel *p, GkrellmDecal *d,
w = gkrellm_gdk_string_width(d->text_style.font, buf) w = gkrellm_gdk_string_width(d->text_style.font, buf)
+ d->text_style.effect; + d->text_style.effect;
} }
d->x_off = d->w - w; d->x_off = d->w - w;
if (d->x_off < 0) if (d->x_off < 0)
d->x_off = 0; d->x_off = 0;
@ -778,7 +778,7 @@ gkrellm_sensors_interface_remove(gint _interface)
} }
} }
} }
while (removed_one); while (removed_one);
} }
static void static void
@ -1036,7 +1036,7 @@ layout_volt_decals(GkrellmPanel *p, GkrellmStyle *style)
cols = n;; cols = n;;
volt_mon_width = w / cols; /* spread them out */ volt_mon_width = w / cols; /* spread them out */
x = (w - cols * volt_mon_width) / 2 + m->left; x = (w - cols * volt_mon_width) / 2 + m->left;
gkrellm_get_top_bottom_margins(style, &y, NULL); gkrellm_get_top_bottom_margins(style, &y, NULL);
c = 0; c = 0;
for (list = volt_list; list; list = list->next) for (list = volt_list; list; list = list->next)
@ -1473,7 +1473,7 @@ make_volt_panel(GtkWidget *vbox, gint first_create)
style = gkrellm_meter_style(style_id); style = gkrellm_meter_style(style_id);
make_volt_decals(pVolt, style); make_volt_decals(pVolt, style);
layout_volt_decals(pVolt, style); layout_volt_decals(pVolt, style);
gkrellm_panel_configure(pVolt, NULL, style); gkrellm_panel_configure(pVolt, NULL, style);
/* Make the bottom margin reference against the bottom volt decals /* Make the bottom margin reference against the bottom volt decals
@ -1587,7 +1587,7 @@ create_sensors(GtkWidget *vbox, gint first_create)
| THEME_DIR/sensors/bg_volt.png | THEME_DIR/sensors/bg_volt.png
| and for a border for it from the gkrellmrc in the format: | and for a border for it from the gkrellmrc in the format:
| set_piximage_border sensors_bg_volt l,r,t,b | set_piximage_border sensors_bg_volt l,r,t,b
| There is no default for bg_volt image, ie it may end up being NULL. | There is no default for bg_volt image, ie it may end up being NULL.
*/ */
xpm = gkrellm_using_default_theme() ? bg_volt_xpm : NULL; xpm = gkrellm_using_default_theme() ? bg_volt_xpm : NULL;
if (bezel_piximage) if (bezel_piximage)
@ -1724,7 +1724,7 @@ save_sensors_config(FILE *f_not_used)
return; return;
sprintf(buf, "%s/%s", GKRELLM_DIR, SENSOR_CONFIG_FILE); sprintf(buf, "%s/%s", GKRELLM_DIR, SENSOR_CONFIG_FILE);
config = gkrellm_make_config_file_name(gkrellm_homedir(), buf); config = gkrellm_make_config_file_name(gkrellm_homedir(), buf);
f = fopen(config, "w"); f = g_fopen(config, "w");
g_free(config); g_free(config);
if (!f) if (!f)
return; return;
@ -1901,14 +1901,14 @@ read_sensors_config(void)
sprintf(buf, "%s/%s", GKRELLM_DIR, SENSOR_CONFIG_FILE); sprintf(buf, "%s/%s", GKRELLM_DIR, SENSOR_CONFIG_FILE);
config = gkrellm_make_config_file_name(gkrellm_homedir(), buf); config = gkrellm_make_config_file_name(gkrellm_homedir(), buf);
f = fopen(config, "r"); f = g_fopen(config, "r");
g_free(config); g_free(config);
if (!f) if (!f)
{ {
sprintf(buf, "%s/%s", GKRELLM_DIR, SENSOR_2_1_14_CONFIG_FILE); sprintf(buf, "%s/%s", GKRELLM_DIR, SENSOR_2_1_14_CONFIG_FILE);
config = gkrellm_make_config_file_name(gkrellm_homedir(), buf); config = gkrellm_make_config_file_name(gkrellm_homedir(), buf);
f = fopen(config, "r"); f = g_fopen(config, "r");
g_free(config); g_free(config);
} }
if (f) if (f)
@ -2526,7 +2526,7 @@ enable_cb(GtkCellRendererText *cell, gchar *path_string, gpointer data)
-1); -1);
s->enabled = !enabled; s->enabled = !enabled;
gtk_tree_store_set(GTK_TREE_STORE(model), &iter, gtk_tree_store_set(GTK_TREE_STORE(model), &iter,
ENABLE_COLUMN, s->enabled, ENABLE_COLUMN, s->enabled,
-1); -1);
change_row_reference(model, path); change_row_reference(model, path);
gtk_tree_path_free(path); gtk_tree_path_free(path);
@ -2655,7 +2655,7 @@ static gchar *sensor_info_text0[] =
"\n", "\n",
}; };
static gchar *sensor_info_text1[] = static gchar *sensor_info_text1[] =
{ {
N_("<h>Setup\n"), N_("<h>Setup\n"),
N_("Enter data scaling factors and offsets for the sensors if the default\n" N_("Enter data scaling factors and offsets for the sensors if the default\n"

View File

@ -216,7 +216,7 @@ gkrellm_homedir(void)
homedir = (gchar *) g_get_home_dir(); homedir = (gchar *) g_get_home_dir();
if (!homedir) if (!homedir)
homedir = "."; homedir = "."; // FIXME: This does not look right to me (stefan)
return homedir; return homedir;
} }
@ -229,11 +229,7 @@ gkrellm_make_home_subdir(gchar *subdir, gchar **path)
dir = g_build_path(G_DIR_SEPARATOR_S, gkrellm_homedir(), subdir, NULL); dir = g_build_path(G_DIR_SEPARATOR_S, gkrellm_homedir(), subdir, NULL);
if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) if (!g_file_test(dir, G_FILE_TEST_IS_DIR))
{ {
#ifdef WIN32 if (g_mkdir(dir, 0755) < 0)
if (mkdir(dir) < 0)
#else
if (mkdir(dir, 0755) < 0)
#endif
printf(_("Cannot create directory: %s\n"), dir); printf(_("Cannot create directory: %s\n"), dir);
else else
result = TRUE; result = TRUE;

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="gkrellm.exe" type="win32"/>
<description>GKrellM</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@ -27,7 +27,7 @@ BEGIN
BEGIN BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "The GKrellM Developers" VALUE "CompanyName", ""
VALUE "FileDescription", "GKrellM" VALUE "FileDescription", "GKrellM"
VALUE "FileVersion", "2.3.2" VALUE "FileVersion", "2.3.2"
VALUE "InternalName", "gkrellm" VALUE "InternalName", "gkrellm"
@ -42,10 +42,3 @@ BEGIN
VALUE "Translation", 1033, 1200 VALUE "Translation", 1033, 1200
END END
END END
//
// Manifest resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
1 RT_MANIFEST "win32-manifest.xml"