Skip to content

fix: make "hide-button" parameter correctly hide the logout button #41

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions lxsession-logout/lxsession-logout.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ typedef struct {

int shutdown_available : 1; /* Shutdown is available */
int reboot_available : 1; /* Reboot is available */
int logout_available : 1; /* Logout is available */
int suspend_available : 1; /* Suspend is available */
int hibernate_available : 1; /* Hibernate is available */
int switch_user_available : 1; /* Switch User is available */
Expand Down Expand Up @@ -566,6 +567,9 @@ int main(int argc, char * argv[])
handler_context.hibernate_UPower = TRUE;
}

/* Initialize capabilities of the Logout. */
handler_context.logout_available = TRUE;

/* If we are under GDM, its "Switch User" is available. */
if (verify_running("gdm", "gdmflexiserver"))
{
Expand Down Expand Up @@ -672,6 +676,9 @@ int main(int argc, char * argv[])
if (strcmp(hide_button[i], "reboot") == 0) {
handler_context.reboot_available = FALSE;
}
if (strcmp(hide_button[i], "logout") == 0) {
handler_context.logout_available = FALSE;
}
if (strcmp(hide_button[i], "hibernate") == 0) {
handler_context.hibernate_available = FALSE;
}
Expand Down Expand Up @@ -825,12 +832,14 @@ int main(int argc, char * argv[])
}

/* Create the Logout button. */
GtkWidget * logout_button = gtk_button_new_with_mnemonic(_("_Logout"));
GtkWidget * image = gtk_image_new_from_icon_name("system-log-out", GTK_ICON_SIZE_BUTTON);
gtk_button_set_image(GTK_BUTTON(logout_button), image);
gtk_button_set_alignment(GTK_BUTTON(logout_button), 0.0, 0.5);
g_signal_connect(G_OBJECT(logout_button), "clicked", G_CALLBACK(logout_clicked), &handler_context);
gtk_box_pack_start(GTK_BOX(controls), logout_button, FALSE, FALSE, 4);
if (handler_context.logout_available) {
GtkWidget * logout_button = gtk_button_new_with_mnemonic(_("_Logout"));
GtkWidget * image = gtk_image_new_from_icon_name("system-log-out", GTK_ICON_SIZE_BUTTON);
gtk_button_set_image(GTK_BUTTON(logout_button), image);
gtk_button_set_alignment(GTK_BUTTON(logout_button), 0.0, 0.5);
g_signal_connect(G_OBJECT(logout_button), "clicked", G_CALLBACK(logout_clicked), &handler_context);
gtk_box_pack_start(GTK_BOX(controls), logout_button, FALSE, FALSE, 4);
}

/* Create the Cancel button. */
GtkWidget * cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
Expand Down
24 changes: 12 additions & 12 deletions po/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ msgstr "图片的位置"

#: ../lxsession-logout/lxsession-logout.c:55
msgid "Hide button"
msgstr ""
msgstr "隐藏按钮"

#: ../lxsession-logout/lxsession-logout.c:625
#, c-format
Expand Down Expand Up @@ -104,7 +104,7 @@ msgstr "信息"

#: ../lxpolkit/main.vala:40
msgid "lxpolkit is already running. Exiting"
msgstr ""
msgstr "lxpolkit 已经运行。退出中"

#: ../lxpolkit/lxpolkit-listener.c:88
msgid ""
Expand Down Expand Up @@ -638,7 +638,7 @@ msgstr "对桌面截图的应用程序,如 scrot..."

#: ../lxsession-default-apps/main.vala:258
msgid "Viewer for PDF, like evince"
msgstr ""
msgstr "PDF 查看器,如 evince"

#: ../lxsession-default-apps/main.vala:263
msgid "Video application"
Expand Down Expand Up @@ -787,7 +787,7 @@ msgstr "取消"

#: ../lxsession/app.vala:1273
msgid "Reboot required"
msgstr ""
msgstr "需要重新启动"

#: ../lxsession/app.vala:1301
#, fuzzy
Expand All @@ -803,11 +803,11 @@ msgstr "启动器管理器"

#: ../lxsession/app.vala:1374
msgid "Language support missing"
msgstr ""
msgstr "语言支持缺失"

#: ../lxsession/app.vala:1416 ../lxsession/app.vala:1520
msgid "Updates available"
msgstr ""
msgstr "有可用更新"

#: ../lxsession/app.vala:1418
#, fuzzy
Expand All @@ -819,23 +819,23 @@ msgstr "启动器管理器"
msgid ""
"An error occurred, please run Package Manager from the left-click menu or "
"apt-get in a terminal to see what is wrong."
msgstr ""
msgstr "发生错误,请从左键菜单中启动软件包管理器或使用终端运行 apt-get 查看错误。"

#: ../lxsession/app.vala:1496
msgid "The error message was: "
msgstr ""
msgstr "错误信息:"

#: ../lxsession/app.vala:1516
msgid " Update available"
msgstr ""
msgstr "有可用更新"

#: ../lxsession/app.vala:1866
msgid "Report "
msgstr ""
msgstr "反馈 "

#: ../lxsession/app.vala:1903
msgid "Crash files available for report"
msgstr ""
msgstr "有可用的崩溃文件供反馈"

#~ msgid "Comment"
#~ msgstr "注释"
Expand Down Expand Up @@ -949,7 +949,7 @@ msgstr ""
#~ msgstr "<b>代理</b>"

#~ msgid "LXSession is not running."
#~ msgstr "LXSession 不在运行。"
#~ msgstr "LXSession 没有运行。"

#~ msgid "Logout"
#~ msgstr "注销"
Expand Down
2 changes: 1 addition & 1 deletion po/zh_TW.po
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ msgstr ""
msgid ""
"Dock is a second panel. It's used to launch a different program to handle a "
"second type of panel."
msgstr ""
msgstr "「Dock」是第二個面板。它用於啟動不同程式來處理另一種類型的面板。"

#: ../lxsession-default-apps/main.vala:183
msgid ""
Expand Down