diff options
-rw-r--r-- | .github/workflows/build.yml | 281 | ||||
-rw-r--r-- | .travis.yml | 11 | ||||
-rw-r--r-- | applets/clock/clock-location-tile.c | 6 | ||||
-rw-r--r-- | applets/clock/clock.c | 22 | ||||
-rw-r--r-- | applets/clock/clock.ui | 3 | ||||
-rw-r--r-- | applets/fish/fish.c | 3 | ||||
-rw-r--r-- | applets/wncklet/window-list.c | 7 | ||||
-rw-r--r-- | applets/wncklet/window-list.ui | 1 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | mate-panel/panel-action-button.c | 4 | ||||
-rw-r--r-- | mate-panel/panel-applet-frame.c | 4 | ||||
-rw-r--r-- | mate-panel/panel-force-quit.c | 6 | ||||
-rw-r--r-- | mate-panel/panel-menu-button.c | 2 | ||||
-rw-r--r-- | mate-panel/panel-recent.c | 6 | ||||
-rw-r--r-- | mate-panel/panel-stock-icons.c | 79 | ||||
-rw-r--r-- | mate-panel/panel-stock-icons.h | 12 | ||||
-rw-r--r-- | mate-panel/panel-toplevel.c | 3 | ||||
-rw-r--r-- | mate-panel/panel.c | 16 |
18 files changed, 338 insertions, 130 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..ba2e0155 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,281 @@ +name: CI Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +# cancel already running builds of the same branch or pull request +concurrency: + group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.sha }} + cancel-in-progress: true + +env: + MATE_PANEL_DEP: 1.28.2 + CONFIGURE_FLAGS: --enable-compile-warnings=maximum + CFLAGS: -g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration + JOBS: 2 + DEBUG: 1 + # Useful URL: https://github.com/mate-desktop/debian-packages + # Useful URL: https://salsa.debian.org/debian-mate-team/mate-panel + DEB_LIBRARY_DEPS: | + libatk1.0-dev + libcairo2-dev + libdconf-dev + libgirepository1.0-dev + libglib2.0-dev + libgtk-3-dev + libgtk-layer-shell-dev + libice-dev + libmate-desktop-dev + libmate-menu-dev + libmateweather-dev + libpango1.0-dev + libsm-dev + libsoup2.4-dev + libwnck-3-dev + libx11-dev + libxrandr-dev + # mate-desktop dependencies + DEB_LIBRARY_DEPS_MATE_DESKTOP: | + libgirepository1.0-dev + DEB_BUILD_DEPS: | + ccache + autoconf-archive + autopoint + gir1.2-freedesktop + git + gobject-introspection + gtk-doc-tools + lsb-release + make + mate-common + meson + yelp-tools + # mate-desktop dependencies + DEB_BUILD_DEPS_MATE_DESKTOP: | + iso-codes + gobject-introspection + # TODO + DEB_SCAN_BUILD_DEPS: | + clang + clang-tools + # Useful URL: https://git.archlinux.org/svntogit/community.git/tree/mate-panel + ARCH_BUILD_DEPS: | + ccache + autoconf-archive + clang + gcc + git + glib2-devel + gobject-introspection + gtk-layer-shell + itstool + libcanberra + libmateweather + libsm + libwnck3 + make + mate-common + mate-desktop + mate-menus + meson + which + yelp-tools + # mate-desktop dependencies + ARCH_BUILD_DEPS_MATE_DESKTOP: | + iso-codes + gobject-introspection + +jobs: + build: + name: Build on ${{matrix.container}} with in-process=${{matrix.in-process}} (using ${{matrix.cc}}) + runs-on: ubuntu-latest + container: ${{matrix.container}} + + strategy: + fail-fast: false # don't cancel other jobs in the matrix if one fails + matrix: + in-process: [all, none] + container: ['debian:testing', 'ubuntu:rolling', 'archlinux:latest'] + cc: ['gcc'] + cxx: ['g++'] + include: + # test with clang on archlinux:latest + - container: 'archlinux:latest' + cc: 'clang' + cxx: 'clang++' + in-process: all + - container: 'archlinux:latest' + cc: 'clang' + cxx: 'clang++' + in-process: none + + env: + # Speed up build with ccache + CC: ccache ${{matrix.cc}} + CXX: ccache ${{matrix.cxx}} + # root install path for the mate-desktop dependency + MATE_DESKTOP_INSTALL_PATH: ${{github.workspace}}/mate-desktop-install + + steps: + # We can't *extend* the environment in 'env' directly, so use GITHUB_ENV + # output variable to do so. + - name: Setup environment + run: | + echo "PATH=${MATE_DESKTOP_INSTALL_PATH}/bin:${PATH}" >> "$GITHUB_ENV" + echo "PKG_CONFIG_PATH=${MATE_DESKTOP_INSTALL_PATH}/lib/pkgconfig:${PKG_CONFIG_PATH}" >> "$GITHUB_ENV" + + # Debugging + - name: Show environment + run: env | sort + if: ${{ env.DEBUG == '1' }} + + # For Debian and Ubuntu (apt-based with reasonably compatible packages) + - name: Install dependencies + if: ${{ startsWith(matrix.container, 'debian:') || startsWith(matrix.container, 'ubuntu:') }} + run: | + apt-get update -qq + apt-get install --assume-yes --no-install-recommends \ + ${DEB_BUILD_DEPS} ${DEB_BUILD_DEPS_MATE_DESKTOP} \ + ${DEB_LIBRARY_DEPS} ${DEB_LIBRARY_DEPS_MATE_DESKTOP} + + # For ArchLinux + - name: Install dependencies + if: ${{ startsWith(matrix.container, 'archlinux:') }} + # don't upgrade, although told otherwise (see link below), because + # apparently in the container it doesn't quit work... + # https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported + run: | + pacman --noconfirm -Syu + pacman --noconfirm -S ${ARCH_BUILD_DEPS} ${ARCH_BUILD_DEPS_MATE_DESKTOP} + + # Checkout the repository + - uses: actions/checkout@v3 + with: + path: mate-panel + submodules: true + + # Setup ccache cache + - name: ccache + uses: hendrikmuhs/[email protected] + with: + key: ${{ github.job }}-${{ matrix.container }}-${{ matrix.cc }} + + # Cache the build of the mate-desktop dependency + - name: Cache mate-desktop v${{env.MATE_PANEL_DEP}} dependency + uses: actions/cache@v3 + id: cache-mate-desktop + with: + path: ${{env.MATE_DESKTOP_INSTALL_PATH}} + # We try and be as specific as possible not to use the wrongly cached + # build, as this is a *binary*. + key: ${{runner.os}}-${{runner.arch}}-${{matrix.container}}-build-mate-desktop-${{env.MATE_PANEL_DEP}} + + # Checkout mate-desktop dep, if not already cached + - name: Checkout mate-desktop v${{env.MATE_PANEL_DEP}} + uses: actions/checkout@v3 + if: ${{ steps.cache-mate-desktop.outputs.cache-hit != 'true' }} + with: + repository: mate-desktop/mate-desktop + ref: v${{env.MATE_PANEL_DEP}} + path: mate-desktop + submodules: true + + # Build and install mate-desktop dep, if not already cached + - name: Install mate-desktop v${{env.MATE_PANEL_DEP}} + if: ${{ steps.cache-mate-desktop.outputs.cache-hit != 'true' }} + run: | + cd mate-desktop + NOCONFIGURE=1 ./autogen.sh + { ./configure --prefix="${MATE_DESKTOP_INSTALL_PATH}" || { cat config.log; exit 1; } ; } + make -j ${{ env.JOBS }} + make -j ${{ env.JOBS }} install + + # Follows regular mate-panel build and test steps + + - name: Configure + run: | + cd mate-panel + NOCONFIGURE=1 ./autogen.sh + { ./configure ${CONFIGURE_FLAGS} --with-in-process-applets=${{matrix.in-process}} || { cat config.log; exit 1; } ; } + + - name: Build + run: make -C mate-panel -j ${{ env.JOBS }} + + - name: Run Tests + run: make -C mate-panel -j ${{ env.JOBS }} check + + - name: Run distcheck + # We only run distcheck on one container, because it takes time and + # doesn't seem so useful to repeat everywhere -- it mostly checks the + # build system itself, rather than the build. + if: ${{ startsWith(matrix.container, 'debian:') }} + run: make -C mate-panel -j ${{ env.JOBS }} distcheck + + # Do we need the real build for cppcheck run? I don't think so + cppcheck: + name: Run cppcheck + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + # Install code dependencies so that cppcheck has more info + - name: Install dependencies + run: | + sudo apt-get update -qq + sudo apt-get install --assume-yes --no-install-recommends \ + cppcheck ${DEB_LIBRARY_DEPS} ${DEB_LIBRARY_DEPS_MATE_DESKTOP} + + # - define relevant configuration I can think of + # - X11-related stuff + # - Wayland-related stuff + # - in-process for Wayland + # - optional features + # - _Noreturn: this is to avoid false positive with functions that + # don't return, like g_assert(false). Here, we rely on G_NORETURN + # (GLib 2.68+) using _Noreturn C11 attribute if __STDC_VERSION__ is + # high enough (cppcheck sets it for us in newer versions, but not on + # here yet); but the version of cppcheck we run on don't know about + # the C11 attribute, so map it to the GCC one it does know. + # This is a tad over-specific, but it removes some spurious warnings, + # and defining e.g. __GNUC__=12 is simpler, but is a *lot* slower + # (more than 3 times slower), and doesn't seem to yield other + # benefits for the moment. + # - -I flags from pkg-config (grepped from configure.ac) + # - ignore non-source directories + - name: cppcheck + env: + checks: warning,style,performance,portability,information,missingInclude + defines: > + -DHAVE_X11 -DHAVE_RANDR + -DHAVE_WAYLAND + -DCLOCK_INPROCESS -DFISH_INPROCESS -DNOTIFICATION_AREA_INPROCESS -DWNCKLET_INPROCESS + -DHAVE_WINDOW_PREVIEWS + -DHAVE_LANGINFO_H -DHAVE_NL_LANGINFO + -DGETTEXT_PACKAGE="mate-panel" + -D__STDC_VERSION__=201112 -D_Noreturn=__attribute__((__noreturn__)) + packages: > + gdk-pixbuf-2.0 + gio-unix-2.0 + gmodule-2.0 + gtk+-3.0 + ice + libwnck-3.0 + mate-desktop-2.0 + sm + run: | + cppcheck --enable="$checks" \ + -j $JOBS \ + $defines \ + $(pkg-config --cflags-only-I $packages) \ + -i gtk-layer-shell-build \ + -i mate-panel/mate-submodules/ \ + . diff --git a/.travis.yml b/.travis.yml index b512bf3d..12de5f7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,9 @@ before_install: - chmod +x docker-build gen-index install: - - pip3 install PyGithub + - sudo apt-get install -y python3-pip python3-setuptools + - sudo pip3 install --upgrade pip + - sudo pip3 install PyGithub - ./docker-build --name ${DISTRO} --config .build.yml --install script: @@ -41,13 +43,14 @@ notifications: before_deploy: - yes | gem update --system --force - gem install bundler + - gem install faraday-net_http -v '3.3.0' # Avoid faraday version problem - gem install uri - gem install logger deploy: - provider: pages edge: - branch: v2.0.3-beta.4 + branch: v2.0.5 token: $GITHUB_TOKEN keep_history: false committer_from_gh: true @@ -59,7 +62,7 @@ deploy: condition: ${DISTRO} =~ ^fedora.*$ - provider: script edge: - branch: v2.0.3-beta.4 + branch: v2.0.5 script: ./docker-build --verbose --config .build.yml --release github on: tags: true @@ -78,6 +81,6 @@ after_success: env: # - DISTRO="archlinux:latest" - - DISTRO="debian:testing" +# - DISTRO="debian:testing" - DISTRO="fedora:latest" # - DISTRO="ubuntu:rolling" diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c index e9260a31..385d0da1 100644 --- a/applets/clock/clock-location-tile.c +++ b/applets/clock/clock-location-tile.c @@ -434,7 +434,7 @@ format_time (struct tm *now, * weekday differs from the weekday at the location * (the %A expands to the weekday). The %p expands to * am/pm. */ - format = _("%l:%M <small>%p (%A)</small>"); + format = _("%_I:%M <small>%p (%A)</small>"); } else { /* Translators: This is a strftime format string. @@ -451,7 +451,7 @@ format_time (struct tm *now, * It is used to display the time in 12-hours format * (eg, like in the US: 8:10 am). The %p expands to * am/pm. */ - format = _("%l:%M <small>%p</small>"); + format = _("%_I:%M <small>%p</small>"); } else { /* Translators: This is a strftime format string. @@ -497,7 +497,7 @@ convert_time_to_str (time_t now, ClockFormat clock_format) * It is used to display the time in 12-hours format (eg, like * in the US: 8:10 am). The %p expands to am/pm. */ - format = _("%l:%M %p"); + format = _("%_I:%M %p"); } else { /* Translators: This is a strftime format string. diff --git a/applets/clock/clock.c b/applets/clock/clock.c index f97e56af..0eee5766 100644 --- a/applets/clock/clock.c +++ b/applets/clock/clock.c @@ -458,7 +458,7 @@ get_updated_timeformat (ClockData *cd) /* Translators: This is a strftime format string. * It is used to display the time in 12-hours format (eg, like * in the US: 8:10 am). The %p expands to am/pm. */ - time_format = cd->showseconds ? _("%l:%M:%S %p") : _("%l:%M %p"); + time_format = cd->showseconds ? _("%_I:%M:%S %p") : _("%_I:%M %p"); else /* Translators: This is a strftime format string. * It is used to display the time in 24-hours format (eg, like @@ -922,8 +922,7 @@ position_calendar_popup (ClockData *cd) button_w = allocation.width; button_h = allocation.height; - screen = gtk_window_get_screen (GTK_WINDOW (cd->calendar_popup)); - display = gdk_screen_get_display (screen); + display = gtk_widget_get_display (GTK_WIDGET (cd->calendar_popup)); n = gdk_display_get_n_monitors (display); for (i = 0; i < n; i++) { @@ -1248,6 +1247,7 @@ location_tile_need_clock_format_cb(ClockLocationTile *tile, gpointer data) static void create_cities_section (ClockData *cd) { + GtkWidget *cities_box; GSList *node; GSList *cities; GSList *l; @@ -1261,8 +1261,16 @@ create_cities_section (ClockData *cd) g_slist_free (cd->location_tiles); cd->location_tiles = NULL; - cd->cities_section = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - gtk_container_set_border_width (GTK_CONTAINER (cd->cities_section), 0); + cd->cities_section = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (cd->cities_section), + GTK_POLICY_NEVER, + GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (cd->cities_section), + GTK_SHADOW_NONE); + gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (cd->cities_section), + TRUE); + + cities_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); cities = cd->locations; if (g_slist_length (cities) == 0) { @@ -1284,7 +1292,7 @@ create_cities_section (ClockData *cd) g_signal_connect (city, "need-clock-format", G_CALLBACK (location_tile_need_clock_format_cb), cd); - gtk_box_pack_start (GTK_BOX (cd->cities_section), + gtk_box_pack_start (GTK_BOX (cities_box), GTK_WIDGET (city), FALSE, FALSE, 0); @@ -1295,6 +1303,8 @@ create_cities_section (ClockData *cd) g_slist_free (node); + gtk_container_add (GTK_CONTAINER (cd->cities_section), cities_box); + gtk_box_pack_end (GTK_BOX (cd->clock_vbox), cd->cities_section, FALSE, FALSE, 0); diff --git a/applets/clock/clock.ui b/applets/clock/clock.ui index fb62507c..b4c4f1b8 100644 --- a/applets/clock/clock.ui +++ b/applets/clock/clock.ui @@ -606,8 +606,9 @@ <object class="GtkScrolledWindow" id="scrolledwindow10"> <property name="visible">True</property> <property name="can-focus">True</property> + <property name="expand">True</property> <property name="hscrollbar-policy">never</property> - <property name="vscrollbar-policy">never</property> + <property name="vscrollbar-policy">automatic</property> <property name="shadow-type">in</property> <child> <object class="GtkTreeView" id="cities_list"> diff --git a/applets/fish/fish.c b/applets/fish/fish.c index 45ce9228..e0898334 100644 --- a/applets/fish/fish.c +++ b/applets/fish/fish.c @@ -937,8 +937,7 @@ static void display_fortune_dialog(FishApplet* fish) clear_fortune_text (fish); - screen = gtk_widget_get_screen (GTK_WIDGET (fish)); - display = gdk_screen_get_display (screen); + display = gtk_widget_get_display (GTK_WIDGET (fish)); display_name = g_strdup (gdk_display_get_name (display)); g_spawn_async_with_pipes (NULL, /* working directory */ argv, diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c index 93785cc1..3e828264 100644 --- a/applets/wncklet/window-list.c +++ b/applets/wncklet/window-list.c @@ -786,16 +786,15 @@ gboolean window_list_applet_fill(MatePanelApplet* applet) tasklist->applet = GTK_WIDGET(applet); provider = gtk_css_provider_new (); - screen = gdk_screen_get_default (); gtk_css_provider_load_from_data (provider, ".mate-panel-menu-bar button,\n" " #tasklist-button {\n" " padding: 0px;\n" " margin: 0px;\n }", -1, NULL); - gtk_style_context_add_provider_for_screen (screen, - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (tasklist->applet), + GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); mate_panel_applet_set_flags(MATE_PANEL_APPLET(tasklist->applet), MATE_PANEL_APPLET_EXPAND_MAJOR | MATE_PANEL_APPLET_EXPAND_MINOR | MATE_PANEL_APPLET_HAS_HANDLE); diff --git a/applets/wncklet/window-list.ui b/applets/wncklet/window-list.ui index 4cc49f9c..2ed06c0e 100644 --- a/applets/wncklet/window-list.ui +++ b/applets/wncklet/window-list.ui @@ -76,6 +76,7 @@ <object class="GtkNotebook"> <property name="visible">True</property> <property name="can-focus">True</property> + <property name="border_width">5</property> <child> <object class="GtkBox" id="behaviour_vbox"> <property name="visible">True</property> diff --git a/configure.ac b/configure.ac index f0b45e2a..ca881ef8 100644 --- a/configure.ac +++ b/configure.ac @@ -60,7 +60,7 @@ GLIB_REQUIRED=2.50.0 LIBMATE_MENU_REQUIRED=1.21.0 CAIRO_REQUIRED=1.0.0 DCONF_REQUIRED=0.13.4 -GTK_REQUIRED=3.22.0 +GTK_REQUIRED=3.24.0 LIBWNCK_REQUIRED=3.4.6 LIBWNCK_PREVIEWS_OPTIONAL=3.32.0 WEATHER_REQUIRED=1.17.0 diff --git a/mate-panel/panel-action-button.c b/mate-panel/panel-action-button.c index 6fad288f..25759d58 100644 --- a/mate-panel/panel-action-button.c +++ b/mate-panel/panel-action-button.c @@ -343,7 +343,7 @@ static void panel_action_shutdown (GtkWidget *widget) { #ifdef HAVE_WAYLAND - GdkDisplay *display = gdk_screen_get_display (gdk_screen_get_default ()); + GdkDisplay *display = gdk_display_get_default (); if (GDK_IS_WAYLAND_DISPLAY (display)) { GtkWidget *dialog, *hbox, *buttonbox, *shutdown_btn, *label; @@ -424,7 +424,7 @@ panel_action_shutdown_reboot_is_disabled (void) if (panel_lockdown_get_disable_log_out()) return TRUE; #ifdef HAVE_WAYLAND - GdkDisplay *display = gdk_screen_get_display (gdk_screen_get_default()); + GdkDisplay *display = gdk_display_get_default (); if (!(panel_lockdown_get_disable_log_out()) && (GDK_IS_WAYLAND_DISPLAY (display))) return FALSE; #endif diff --git a/mate-panel/panel-applet-frame.c b/mate-panel/panel-applet-frame.c index 2b0e4b7f..cadd81aa 100644 --- a/mate-panel/panel-applet-frame.c +++ b/mate-panel/panel-applet-frame.c @@ -962,8 +962,8 @@ mate_panel_applet_frame_loading_failed (const char *iid, _("Do you want to delete the applet " "from your configuration?")); - gtk_dialog_add_button (GTK_DIALOG (dialog), - PANEL_STOCK_DONT_DELETE, LOADING_FAILED_RESPONSE_DONT_DELETE); + panel_dialog_add_button (GTK_DIALOG (dialog), + _("_Don't Delete"), "gtk-cancel", LOADING_FAILED_RESPONSE_DONT_DELETE); panel_dialog_add_button (GTK_DIALOG (dialog), _("_Delete"), "edit-delete", LOADING_FAILED_RESPONSE_DELETE); diff --git a/mate-panel/panel-force-quit.c b/mate-panel/panel-force-quit.c index 13b0139f..50a3be7d 100644 --- a/mate-panel/panel-force-quit.c +++ b/mate-panel/panel-force-quit.c @@ -249,9 +249,9 @@ kill_window_question (gpointer window) _("_Cancel"), "process-stop", GTK_RESPONSE_CANCEL); - gtk_dialog_add_button (GTK_DIALOG (dialog), - PANEL_STOCK_FORCE_QUIT, - GTK_RESPONSE_ACCEPT); + panel_dialog_add_button (GTK_DIALOG (dialog), + _("_Force Quit"), "process-stop", + GTK_RESPONSE_ACCEPT); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL); diff --git a/mate-panel/panel-menu-button.c b/mate-panel/panel-menu-button.c index 92925fd8..e65a99d6 100644 --- a/mate-panel/panel-menu-button.c +++ b/mate-panel/panel-menu-button.c @@ -694,6 +694,8 @@ panel_menu_button_load (const char *menu_path, return; } + gtk_widget_set_name (GTK_WIDGET (button), "mate-panel-main-menu-button"); + button->priv->applet_id = g_strdup (info->id); mate_panel_applet_add_callback (info, "help", "help-browser", _("_Help"), NULL); diff --git a/mate-panel/panel-recent.c b/mate-panel/panel-recent.c index 2ed4715e..5fe25ddb 100644 --- a/mate-panel/panel-recent.c +++ b/mate-panel/panel-recent.c @@ -156,9 +156,9 @@ recent_documents_clear_cb (GtkMenuItem *menuitem, _("_Cancel"), "process-stop", GTK_RESPONSE_CANCEL); - gtk_dialog_add_button (GTK_DIALOG (clear_recent_dialog), - PANEL_STOCK_CLEAR, - GTK_RESPONSE_ACCEPT); + panel_dialog_add_button (GTK_DIALOG (clear_recent_dialog), + _("_Clear"), "edit-clear", + GTK_RESPONSE_ACCEPT); gtk_container_set_border_width (GTK_CONTAINER (clear_recent_dialog), 6); diff --git a/mate-panel/panel-stock-icons.c b/mate-panel/panel-stock-icons.c index 8e124709..bab01a33 100644 --- a/mate-panel/panel-stock-icons.c +++ b/mate-panel/panel-stock-icons.c @@ -54,83 +54,10 @@ GtkIconSize panel_add_to_icon_get_size(void) return panel_add_to_icon_size; } -typedef struct { - char *stock_id; - char *icon; -} PanelStockIcon; - -static PanelStockIcon stock_icons [] = { - { PANEL_STOCK_FORCE_QUIT, PANEL_ICON_FORCE_QUIT } -}; - -static void -panel_init_stock_icons (GtkIconFactory *factory) -{ - GtkIconSource *source; - gsize i; - - source = gtk_icon_source_new (); - - for (i = 0; i < G_N_ELEMENTS (stock_icons); i++) { - GtkIconSet *set; - - gtk_icon_source_set_icon_name (source, stock_icons [i].icon); - - set = gtk_icon_set_new (); - gtk_icon_set_add_source (set, source); - - gtk_icon_factory_add (factory, stock_icons [i].stock_id, set); - gtk_icon_set_unref (set); - } - - gtk_icon_source_free (source); - -} - -typedef struct { - char *stock_id; - char *stock_icon_id; - char *label; -} PanelStockItem; - -static PanelStockItem stock_items [] = { - { PANEL_STOCK_EXECUTE, "gtk-execute", N_("_Run") }, - { PANEL_STOCK_FORCE_QUIT, PANEL_STOCK_FORCE_QUIT, N_("_Force quit") }, - { PANEL_STOCK_CLEAR, "gtk-clear", N_("C_lear") }, - { PANEL_STOCK_DONT_DELETE, "gtk-cancel", N_("D_on't Delete") } -}; - -static void -panel_init_stock_items (GtkIconFactory *factory) -{ - GtkStockItem *items; - gsize n_items; - gsize i; - - n_items = G_N_ELEMENTS (stock_items); - items = g_new (GtkStockItem, n_items); - - for (i = 0; i < n_items; i++) { - GtkIconSet *icon_set; - - items [i].stock_id = g_strdup (stock_items [i].stock_id); - items [i].label = g_strdup (stock_items [i].label); - items [i].modifier = 0; - items [i].keyval = 0; - items [i].translation_domain = g_strdup (GETTEXT_PACKAGE); - - /* FIXME: does this take into account the theme? */ - icon_set = gtk_icon_factory_lookup_default (stock_items [i].stock_icon_id); - gtk_icon_factory_add (factory, stock_items [i].stock_id, icon_set); - } - - gtk_stock_add_static (items, n_items); -} void panel_init_stock_icons_and_items (void) { - GtkIconFactory *factory; GSettings *settings; gint icon_size; @@ -163,12 +90,6 @@ panel_init_stock_icons_and_items (void) PANEL_ADD_TO_DEFAULT_ICON_SIZE, PANEL_ADD_TO_DEFAULT_ICON_SIZE); - factory = gtk_icon_factory_new (); - gtk_icon_factory_add_default (factory); - - panel_init_stock_icons (factory); - panel_init_stock_items (factory); - g_object_unref (factory); g_object_unref (settings); } diff --git a/mate-panel/panel-stock-icons.h b/mate-panel/panel-stock-icons.h index a43ca699..eeb536e8 100644 --- a/mate-panel/panel-stock-icons.h +++ b/mate-panel/panel-stock-icons.h @@ -41,18 +41,6 @@ extern "C" { #define PANEL_ADD_TO_DEFAULT_ICON_SIZE 32 -/* stock icons */ -#define PANEL_STOCK_FORCE_QUIT "mate-panel-force-quit" - -/* stock items - no point in theme the icons one these, - * they use stock gtk icons and just modify the text - * for the stock item. - */ -#define PANEL_STOCK_EXECUTE "panel-execute" -#define PANEL_STOCK_CLEAR "panel-clear" -#define PANEL_STOCK_DONT_DELETE "panel-dont-delete" -/* FIXME: put a more representative icon here */ -#define PANEL_STOCK_DEFAULT_ICON "application-default-icon" void panel_init_stock_icons_and_items (void); GtkIconSize panel_menu_icon_get_size (void); diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c index 2eb6e77a..a57c42e9 100644 --- a/mate-panel/panel-toplevel.c +++ b/mate-panel/panel-toplevel.c @@ -852,12 +852,11 @@ static void panel_toplevel_rotate_to_pointer(PanelToplevel* toplevel, int pointe #ifdef HAVE_X11 static gboolean panel_toplevel_warp_pointer_increment(PanelToplevel* toplevel, int keyval, int increment) { - GdkScreen *screen; GdkWindow *root_window; GdkDevice *device; int new_x, new_y; - screen = gtk_window_get_screen (GTK_WINDOW (toplevel)); + GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (toplevel)); g_return_val_if_fail (GDK_IS_X11_SCREEN (screen), FALSE); root_window = gdk_screen_get_root_window (screen); device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET(root_window)))); diff --git a/mate-panel/panel.c b/mate-panel/panel.c index e854cf73..065d2090 100644 --- a/mate-panel/panel.c +++ b/mate-panel/panel.c @@ -454,7 +454,8 @@ set_background_image_from_uri (PanelToplevel *toplevel, static gboolean set_background_color (PanelToplevel *toplevel, - guint16 *dropped) + guint16 *dropped, + gint length) { GdkRGBA color; @@ -465,10 +466,11 @@ set_background_color (PanelToplevel *toplevel, ! panel_profile_background_key_is_writable (toplevel, "type")) return FALSE; - color.red = dropped [0]; - color.green = dropped [1]; - color.blue = dropped [2]; - color.alpha = 1.; + const gdouble scale = 1.0 / 65535.0; + color.red = dropped[0] * scale; + color.green = dropped[1] * scale; + color.blue = dropped[2] * scale; + color.alpha = (length > 3) ? dropped[3] * scale : 1.0; panel_profile_set_background_color (toplevel, &color); panel_profile_set_background_type (toplevel, PANEL_BACK_COLOR); @@ -1232,7 +1234,9 @@ panel_receive_dnd_data (PanelWidget *panel, success = drop_url (panel, pos, (char *)data); break; case TARGET_COLOR: - success = set_background_color (panel->toplevel, (guint16 *) data); + gint n_bytes = gtk_selection_data_get_length (selection_data); + gint length = n_bytes / sizeof (guint16); + success = set_background_color (panel->toplevel, (guint16 *) data, length); break; case TARGET_BGIMAGE: success = set_background_image_from_uri (panel->toplevel, (char *) data); |