Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better appearance integration, allowing easy themeability #7

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
61 changes: 39 additions & 22 deletions [email protected]/gtgcalendarmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ const GTGCalendarMenu = new Lang.Class({

// Scroll view
this.scrollView = new St.ScrollView({style_class: 'vfade',
hscrollbar_policy: Gtk.PolicyType.NEVER,
vscrollbar_policy: Gtk.PolicyType.ALWAYS});
hscrollbar_policy: Gtk.PolicyType.NEVER});
this.scrollView.add_actor(this.mainBox);
this.mainBox.add_actor(this.scrollView, {expand: true});

Expand Down Expand Up @@ -155,13 +154,17 @@ const GTGCalendarMenu = new Lang.Class({
else
{
dateFormat = _("%A, %B %d");
strTitle = day.toLocaleFormat(dateFormat);
}
title = new PopupMenu.PopupMenuItem(strTitle, {reactive: false});
title.actor.set_style("padding-top : 10px");
// Check preferences
if (prefs.SystemTheme)
title.actor.add_style_class_name("dayTitle");
strTitle = day.toLocaleFormat(dateFormat);
}
title = new PopupMenu.PopupMenuItem(strTitle, {reactive: false});
// Check preferences
if (prefs.SystemTheme) {
title.actor.remove_style_class_name("popup-menu-item");
title.actor.remove_style_class_name("popup-inactive-menu-item");
title.actor.add_style_class_name("events-day-header");
} else {
title.actor.add_style_class_name("dayTitle-custom");
}

this.tasksBox.add(title.actor,{y_align: St.Align.START,y_fill: false});
actors.push(title);
Expand All @@ -175,7 +178,7 @@ const GTGCalendarMenu = new Lang.Class({
{
var nbTasks = 0;
// First block
for (i=0; i<allTasks.length; i++)
for (let i = 0; i < allTasks.length; i++)
{
let ret = allTasks[i].startdate.split('-');
let startDate = new Date(ret[0],ret[1]-1,ret[2]);
Expand All @@ -201,7 +204,7 @@ const GTGCalendarMenu = new Lang.Class({
}

// Second block
for (i=0; i<allTasks.length; i++)
for (let i = 0; i < allTasks.length; i++)
{
let ret = allTasks[i].startdate.split('-');
let startDate = new Date(ret[0],ret[1]-1,ret[2]);
Expand Down Expand Up @@ -266,36 +269,48 @@ const GTGCalendarMenu = new Lang.Class({
strTask = strTask.substr(0,LENGTHMAX) + "..."

let taskItem = new PopupMenu.PopupMenuItem(strTask);
taskItem.actor.set_style("padding-left:50px;");
//taskItem.actor.set_style("padding-left:50px;");

taskItem.connect('activate', function() {
GTGDBus.openTaskEditor(task.id);
Main.panel.statusArea.dateMenu.menu.close();
});

// Check preferences
if (multipleDayTask)
if (prefs.SystemTheme)
if (multipleDayTask) {
if (prefs.SystemTheme) {
taskItem.actor.add_style_class_name("events-day-task");
taskItem.actor.add_style_class_name("multipleDayTask");
else
if (prefs.SystemTheme)
taskItem.actor.add_style_class_name("task");

} else {
taskItem.actor.add_style_class_name("multipleDayTask-custom");
}
} else {
if (prefs.SystemTheme) {
taskItem.actor.add_style_class_name("events-day-task");
} else {
taskItem.actor.add_style_class_name("task-custom");
}
}

this.tasksBox.add(taskItem.actor,{y_align: St.Align.START,y_fill: false});
actors.push(taskItem);
},

// FIXME: Duplicated code
// Display a blocked item (non-clickable) with given string
displayBlockedItem: function(title)
{
let item = new PopupMenu.PopupMenuItem(title,{reactive:false});
item.actor.set_style("padding-left:50px");

// Check preferences
if (prefs.SystemTheme)
item.actor.add_style_class_name("task");
if (prefs.SystemTheme) {
item.actor.remove_style_class_name("popup-inactive-menu-item");
item.actor.add_style_class_name("events-day-task");
} else {
item.actor.add_style_class_name("task-custom");
}

this.tasksBox.add(item.actor,{y_align: St.Align.START,y_fill: false});
this.tasksBox.add(item.actor,{y_align: St.Align.START,y_fill: false});
actors.push(item);
},

Expand Down Expand Up @@ -342,6 +357,7 @@ const GTGCalendarMenu = new Lang.Class({
{
this.tasksBox.remove_actor(actors[i].actor);
}
actors = [];
},

// Open GTG if it's closed
Expand Down Expand Up @@ -442,3 +458,4 @@ function loadPreferences()
else
showSystemTasksList();
}

57 changes: 38 additions & 19 deletions [email protected]/gtgtodomenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const Extension = ExtensionUtils.getCurrentExtension();
const GTGCalendarMenu = Extension.imports.gtgcalendarmenu;
const GTGDBus = Extension.imports.gtgdbus;
const Preferences = Extension.imports.prefs;
const Gettext = imports.gettext;
const _ = Gettext.domain('gtgextension').gettext;

const LENGTHMAX = 40; // Maximum length of a displayed task

Expand All @@ -24,6 +26,9 @@ const GTGTodoMenu = new Lang.Class({

_init: function()
{
let locales = Extension.dir.get_path() + "/locale";
Gettext.bindtextdomain('gtgextension', locales);

// Load tasks
allTasks = new Array();
loadTasks();
Expand Down Expand Up @@ -62,8 +67,7 @@ const GTGTodoMenu = new Lang.Class({

// Scroll view
this.scrollView = new St.ScrollView({style_class: 'vfade',
hscrollbar_policy: Gtk.PolicyType.NEVER,
vscrollbar_policy: Gtk.PolicyType.ALWAYS});
hscrollbar_policy: Gtk.PolicyType.NEVER});
this.scrollView.add_actor(this.todoBox);
calendar.add_actor(this.scrollView);

Expand All @@ -89,37 +93,49 @@ const GTGTodoMenu = new Lang.Class({
// Remove actual actors
for (let i=0; i<actors.length; i++)
this.todoBox.remove_actor(actors[i].actor);

// Display tasks only if gtg is running
if (!running)
{
this.displayBlockedItem("GTG is closed");

let title = new PopupMenu.PopupMenuItem(_("To do"), {reactive: false});
if (prefs.SystemTheme) {
title.actor.remove_style_class_name("popup-menu-item");
title.actor.remove_style_class_name("popup-inactive-menu-item");
title.actor.add_style_class_name("events-day-header");
} else {
title.actor.add_style_class_name("dayTitle-custom");
}
else
{
this.todoBox.add(title.actor,{y_align: St.Align.START,y_fill: false});
actors.push(title);

// Display tasks only if gtg is running
if (!running) {
this.displayBlockedItem(_("GTG is closed"));
} else {
// Display all tasks without start and due date
var nbTasks = 0;
for (i=0; i<allTasks.length; i++)
for (let i = 0; i < allTasks.length; i++)
if (allTasks[i].startdate == "" && allTasks[i].duedate == "")
{
this.displayTodo(allTasks[i]);
nbTasks++;
}
if (nbTasks < 1)
this.displayBlockedItem("Nothing");
this.displayBlockedItem(_("Nothing Scheduled"));
}
},

// FIXME: Duplicated code
// Display a blocked item (non-clickable) with given string
displayBlockedItem: function(title)
{
let item = new PopupMenu.PopupMenuItem(title,{reactive:false});

// Check preferences
if (prefs.SystemTheme)
item.actor.add_style_class_name("task");

this.todoBox.add(item.actor,{y_align: St.Align.START,y_fill: false});
if (prefs.SystemTheme) {
item.actor.remove_style_class_name("popup-inactive-menu-item");
item.actor.add_style_class_name("events-day-task");
} else {
item.actor.add_style_class_name("task-custom");
}

this.todoBox.add(item.actor,{y_align: St.Align.START,y_fill: false});
actors.push(item);
},

Expand All @@ -134,9 +150,12 @@ const GTGTodoMenu = new Lang.Class({
let item = new PopupMenu.PopupMenuItem(title);

// Check preferences
if (prefs.SystemTheme)
item.actor.add_style_class_name("task");

if (prefs.SystemTheme) {
item.actor.add_style_class_name("events-day-task");
} else {
item.actor.add_style_class_name("task-custom");
}

item.connect('activate', function() {
GTGDBus.openTaskEditor(task.id);
Main.panel.statusArea.dateMenu.menu.close();
Expand Down
3 changes: 3 additions & 0 deletions [email protected]/locale/af/LC_MESSAGES/af.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Open GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/af/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/an/LC_MESSAGES/an.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Ubrir GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/an/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/ar/LC_MESSAGES/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "افتح GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/ar/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/as/LC_MESSAGES/as.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "খোলক GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/as/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/ast/LC_MESSAGES/ast.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Abrir GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/ast/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/be/LC_MESSAGES/be.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Адкрыць GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/be/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/bg/LC_MESSAGES/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Отваряне GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/bg/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/bn/LC_MESSAGES/bn.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "খুলুন GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/bn/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/bn_IN/LC_MESSAGES/bn_IN.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "খুলুন GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/bn_IN/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/ca/LC_MESSAGES/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Obre GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/ca/LC_MESSAGES/gtgextension.mo
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Obri GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/ca@valencia/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/cs/LC_MESSAGES/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Otevřít GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/cs/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/da/LC_MESSAGES/da.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Åbn GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/da/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/de/LC_MESSAGES/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Öffnen GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/de/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/el/LC_MESSAGES/el.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Άνοιγμα GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/el/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/en_GB/LC_MESSAGES/en_GB.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Open GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/en_GB/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/eo/LC_MESSAGES/eo.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Malfermi GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/eo/LC_MESSAGES/gtgextension.mo
Binary file not shown.
5 changes: 4 additions & 1 deletion [email protected]/locale/es/LC_MESSAGES/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ msgid "Open GTG"
msgstr "Abrir GTG"

msgid "GTG is closed"
msgstr "GTG is closed"
msgstr "GTG está cerrado"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/es/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/et/LC_MESSAGES/et.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Ava GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/et/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/eu/LC_MESSAGES/eu.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Ireki GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/eu/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/fa/LC_MESSAGES/fa.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "بازکردن GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/fa/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/fi/LC_MESSAGES/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Avaa GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/fi/LC_MESSAGES/gtgextension.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions [email protected]/locale/fr/LC_MESSAGES/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ msgstr "Ouvrir GTG"

msgid "GTG is closed"
msgstr "GTG is closed"

msgid "To do"
msgstr "To do"
Binary file modified [email protected]/locale/fr/LC_MESSAGES/gtgextension.mo
Binary file not shown.
Loading