~ayatana-scrollbar-team/overlay-scrollbar/overlay-touch-mode

« back to all changes in this revision

Viewing changes to os/os-utils.c

  • Committer: Andrea Cimitan
  • Date: 2012-04-27 13:49:56 UTC
  • mfrom: (343.1.10 module)
  • Revision ID: andrea.cimitan@canonical.com-20120427134956-ddwhpqx6b697ood7
Tags: 0.3.0
Port to GtkModule

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* overlay-scrollbar
2
 
 *
3
 
 * Copyright © 2011 Canonical Ltd
4
 
 *
5
 
 * This library is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU Lesser General Public
7
 
 * License as published by the Free Software Foundation; either
8
 
 * version 2.1 of the License, or (at your option) any later version.
9
 
 *
10
 
 * This library is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 * Lesser General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU Lesser General Public
16
 
 * License along with this library; if not, write to the
17
 
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 
 * Boston, MA 02110-1301 USA
19
 
 *
20
 
 * Authored by Andrea Cimitan <andrea.cimitan@canonical.com>
21
 
 */
22
 
 
23
 
#ifndef HAVE_CONFIG_H
24
 
#include "config.h"
25
 
#endif /* hAVE_CONFIG_H */
26
 
 
27
 
#include "os-utils.h"
28
 
 
29
 
/* Public functions. */
30
 
 
31
 
/**
32
 
 * os_utils_is_blacklisted :
33
 
 * @program: a gchar of the program to check
34
 
 *
35
 
 * Returns: TRUE if the program is blacklisted. 
36
 
 **/
37
 
gboolean
38
 
os_utils_is_blacklisted (const gchar *program)
39
 
{
40
 
  /* Black-list of program names retrieved with g_get_prgname (). */
41
 
  static const gchar *blacklist[] = {
42
 
    "acroread", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/876218 */
43
 
    "eclipse", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/769277 */
44
 
    "emacs", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/847940 */
45
 
    "emacs23", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/847940 */
46
 
    "firefox", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/847922 */
47
 
    "firefox-bin", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/847922 */
48
 
    "firefox-trunk", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/847922 */
49
 
    "gimp", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/803163 */
50
 
    "gimp-2.6", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/803163 */
51
 
    "gimp-2.7", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/803163 */
52
 
    "gimp-2.8", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/803163 */
53
 
    "gnucash", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/770304 */
54
 
    "gvim", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/847943 */
55
 
    "notes.bin", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/890986 */
56
 
    "soffice", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/847918 */
57
 
    "synaptic", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/755238 */
58
 
    "thunderbird-bin", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/847929 */
59
 
    "vinagre", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/847932 */
60
 
    "vmplayer", /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/770625 */
61
 
    "vmware"/* https://bugs.launchpad.net/ayatana-scrollbar/+bug/770625 */
62
 
  };
63
 
 
64
 
  GModule *module;
65
 
  GSettings *interface_settings;
66
 
  gpointer func;
67
 
  gboolean settings_key;
68
 
  gint32 i;
69
 
  const gint32 nr_programs = G_N_ELEMENTS (blacklist);
70
 
 
71
 
  /* Read the gsettings key. */
72
 
  interface_settings = g_settings_new ("org.gnome.desktop.interface");
73
 
  settings_key = g_settings_get_boolean (interface_settings, "ubuntu-overlay-scrollbars");
74
 
  g_object_unref (interface_settings);
75
 
 
76
 
  if (!settings_key)
77
 
    return TRUE;
78
 
 
79
 
  /* Black-list of symbols. */
80
 
  module = g_module_open (NULL, 0);
81
 
  /* https://bugs.launchpad.net/ayatana-scrollbar/+bug/847966 */
82
 
  if (g_module_symbol (module, "qt_startup_hook", &func))
83
 
    {
84
 
      g_module_close (module);
85
 
      return TRUE;
86
 
    }
87
 
  g_module_close (module);
88
 
 
89
 
  for (i = 0; i < nr_programs; i++)
90
 
    if (g_strcmp0 (blacklist[i], program) == 0)
91
 
      return TRUE;
92
 
 
93
 
  return FALSE;
94
 
}