tags 384133 + patch
thx!
-------
Hi Erich,
I agree that it's best to remain low on debconf questions.
I here attach a patch as an implementation proposal.
The option appears in the main mail-notification preferences dialog.
Could you test it and tell me if you're statisfied with this proposal?
thanks,
-Pascal
PS: The patch is lacking translations.
--
Homepage (http://organact.mine.nu)
Debian GNU/Linux (http://www.debian.org)
--- src/mn-conf.h.old 2006-05-18 09:23:42.000000000 -0400
+++ src/mn-conf.h 2006-08-23 01:16:16.000000000 -0400
@@ -89,6 +89,8 @@
MN_CONF_MAIL_SUMMARY_POPUP_FONTS_CONTENTS_NAMESPACE "/font"
#define MN_CONF_DISPLAY_SEEN_MAIL \
MN_CONF_NAMESPACE "/display-seen-mail"
+#define MN_CONF_AUTOSTART \
+ MN_CONF_NAMESPACE "/autostart-mn"
#define MN_CONF_TOOLTIP_MAIL_SUMMARY \
MN_CONF_NAMESPACE "/tooltip-mail-summary"
#define MN_CONF_ALWAYS_DISPLAY_ICON \
--- src/mn-properties-dialog.gob.old 2006-05-18 09:23:42.000000000 -0400
+++ src/mn-properties-dialog.gob 2006-08-23 02:25:18.000000000 -0400
@@ -48,6 +48,7 @@
/* general tab */
private GtkWidget *display_seen_mail_check;
+ private GtkWidget *autostart_mn;
private GtkWidget *scrolled;
private GtkWidget *list;
private GtkWidget *selected_label;
@@ -122,6 +123,7 @@
"mn_properties_dialog_",
"notebook", &selfp->notebook,
"display_seen_mail_check",
&selfp->display_seen_mail_check,
+ "autostart_mn", &selfp->autostart_mn,
"scrolled", &selfp->scrolled,
"selected_label", &selfp->selected_label,
"remove", &selfp->remove,
@@ -220,6 +222,7 @@
mn_conf_link(self, MN_CONF_PROPERTIES_DIALOG,
selfp->display_seen_mail_check, MN_CONF_DISPLAY_SEEN_MAIL,
"active",
+ selfp->autostart_mn, MN_CONF_AUTOSTART, "active",
selfp->command_new_mail_check,
MN_CONF_COMMANDS_NEW_MAIL_ENABLED, "active",
selfp->command_new_mail_entry,
MN_CONF_COMMANDS_NEW_MAIL_COMMAND, "text",
selfp->command_mail_read_check,
MN_CONF_COMMANDS_MAIL_READ_ENABLED, "active",
@@ -412,6 +415,32 @@
}
protected void
+ autostart_mn_toggled_h (self, GtkButton *button)
+ {
+ // Freedesktop.org standard for autostarting applications
+ const char *filename = "~/.config/mail-notification.desktop";
+ FILE *file;
+
+ // Create the desktop file
+ if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(selfp->autostart_mn)) ){
+
+ if ((file = fopen( filename, "wt")) == NULL) {
+ fprintf( stderr, "Can't create autostart file: %s", filename );
+ }
+ fprintf( file, "[Desktop Entry]\n" );
+ fprintf( file, "Name=mail-notification\n" );
+ fprintf( file, "Encoding=UTF-8\n" );
+ fprintf( file, "Version=1.0\n" );
+ fprintf( file, "Exec=mail-notification --sm-disable\n\n" );
+ fclose( file );
+ } else {
+ if( unlink( filename ) != 0 ) {
+ printf( "Failed to delete %s\n", filename );
+ }
+ }
+ }
+
+ protected void
add_clicked_h (self, GtkButton *button)
{
mn_mailbox_view_activate_add(MN_MAILBOX_VIEW(selfp->list));
--- ui/properties-dialog.glade.old 2006-05-03 21:32:03.000000000 -0400
+++ ui/properties-dialog.glade 2006-08-23 01:27:17.000000000 -0400
@@ -2,7 +2,6 @@
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
-<requires lib="gnome"/>
<widget class="GtkDialog" id="dialog">
<property name="border_width">5</property>
@@ -125,6 +124,26 @@
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkCheckButton" id="autostart_mn">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label"
translatable="yes">Autostart mail-notification at startup</property>
+ <property name="use_underline">True</property>
+ <property
name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled"
handler="autostart_mn_toggled_h" last_modification_time="Wed, 23 Aug 2006
05:19:55 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>