~muktupavels/indicator-applet/port-to-libgnome-panel

« back to all changes in this revision

Viewing changes to src/indicator-applet-session.c

  • Committer: Alberts Muktupāvels
  • Date: 2020-03-22 12:39:10 UTC
  • Revision ID: alberts.muktupavels@gmail.com-20200322123910-u5i7wamgf1eytrtk
Port applet to libgnome-panel library.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2020 Alberts Muktupāvels
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation, either version 3 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 
16
 */
 
17
 
 
18
#include "config.h"
 
19
#include "indicator-applet-session.h"
 
20
 
 
21
#include <glib/gi18n-lib.h>
 
22
 
 
23
struct _IndicatorAppletSession
 
24
{
 
25
  IndicatorApplet parent;
 
26
};
 
27
 
 
28
G_DEFINE_TYPE (IndicatorAppletSession,
 
29
               indicator_applet_session,
 
30
               INDICATOR_TYPE_APPLET)
 
31
 
 
32
static const char *
 
33
indicator_applet_session_get_name (void)
 
34
{
 
35
  return _("Indicator Applet Session");
 
36
}
 
37
 
 
38
static const char *
 
39
indicator_applet_session_get_description (void)
 
40
{
 
41
  return _("A place to adjust your status, change users or exit your session.");
 
42
}
 
43
 
 
44
static const char *
 
45
indicator_applet_session_get_indicator_env (void)
 
46
{
 
47
  return "indicator-applet-session";
 
48
}
 
49
 
 
50
static gboolean
 
51
indicator_applet_session_load_module (const char *name)
 
52
{
 
53
  return g_strcmp0 (name, "libsession.so") == 0 ||
 
54
         g_strcmp0 (name, "libme.so") == 0;
 
55
}
 
56
 
 
57
static gboolean
 
58
indicator_applet_session_load_indicator (const char *name)
 
59
{
 
60
  return g_strcmp0 (name, "com.canonical.indicator.session") == 0 ||
 
61
         g_strcmp0 (name, "com.canonical.indicator.me") == 0;
 
62
}
 
63
 
 
64
static const char *
 
65
indicator_applet_session_get_hotkey_keycode (void)
 
66
{
 
67
  return "<Super>S";
 
68
}
 
69
 
 
70
static void
 
71
indicator_applet_session_class_init (IndicatorAppletSessionClass *self_class)
 
72
{
 
73
  IndicatorAppletClass *applet_class;
 
74
 
 
75
  applet_class = INDICATOR_APPLET_CLASS (self_class);
 
76
 
 
77
  applet_class->get_name = indicator_applet_session_get_name;
 
78
  applet_class->get_description = indicator_applet_session_get_description;
 
79
  applet_class->get_indicator_env = indicator_applet_session_get_indicator_env;
 
80
  applet_class->load_module = indicator_applet_session_load_module;
 
81
  applet_class->load_indicator = indicator_applet_session_load_indicator;
 
82
 
 
83
  applet_class->get_hotkey_keycode = indicator_applet_session_get_hotkey_keycode;
 
84
}
 
85
 
 
86
static void
 
87
indicator_applet_session_init (IndicatorAppletSession *self)
 
88
{
 
89
  AtkObject *atk_object;
 
90
 
 
91
  atk_object = gtk_widget_get_accessible (GTK_WIDGET (self));
 
92
  atk_object_set_name (atk_object, "indicator-applet-session");
 
93
}